﻿///////////////////////////////////////////////////////////////
// This is generated code. 
//////////////////////////////////////////////////////////////
// Code is generated using LLBLGen Pro version: 2.6
// Code is generated on: 2011年7月5日 11:37:43
// Code is generated using templates: SD.TemplateBindings.SharedTemplates.NET20
// Templates vendor: Solutions Design.
// Templates version: 
//////////////////////////////////////////////////////////////
using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Collections;
#if !CF
using System.Runtime.Serialization;
#endif
using System.Data;
using System.Xml.Serialization;
using CARMSData;
using CARMSData.FactoryClasses;
using CARMSData.DaoClasses;
using CARMSData.RelationClasses;
using CARMSData.HelperClasses;
using CARMSData.CollectionClasses;

using SD.LLBLGen.Pro.ORMSupportClasses;

namespace CARMSData.EntityClasses
{
	
	// __LLBLGENPRO_USER_CODE_REGION_START AdditionalNamespaces
	// __LLBLGENPRO_USER_CODE_REGION_END

	/// <summary>
	/// Entity class which represents the entity 'User'. <br/><br/>
	/// 
	/// </summary>
	[Serializable]
	public partial class UserEntity : CommonEntityBase, ISerializable
		// __LLBLGENPRO_USER_CODE_REGION_START AdditionalInterfaces
		// __LLBLGENPRO_USER_CODE_REGION_END	
	{
		#region Class Member Declarations
		private CARMSData.CollectionClasses.MessageCollection	_message;
		private bool	_alwaysFetchMessage, _alreadyFetchedMessage;
		private CARMSData.CollectionClasses.ReportHeaderCollection	_reportHeader;
		private bool	_alwaysFetchReportHeader, _alreadyFetchedReportHeader;
		private CARMSData.CollectionClasses.UserActionCollection	_userAction;
		private bool	_alwaysFetchUserAction, _alreadyFetchedUserAction;
		private CARMSData.CollectionClasses.UserPermissionCollection	_userPermission;
		private bool	_alwaysFetchUserPermission, _alreadyFetchedUserPermission;
		private CARMSData.CollectionClasses.UserRoleCollection	_userRole;
		private bool	_alwaysFetchUserRole, _alreadyFetchedUserRole;
		private CARMSData.CollectionClasses.ActionCollection _actionCollectionViaUserAction;
		private bool	_alwaysFetchActionCollectionViaUserAction, _alreadyFetchedActionCollectionViaUserAction;
		private CARMSData.CollectionClasses.ReportCategoryCollection _reportCategoryCollectionViaReportHeader;
		private bool	_alwaysFetchReportCategoryCollectionViaReportHeader, _alreadyFetchedReportCategoryCollectionViaReportHeader;
		private CARMSData.CollectionClasses.ReportCategoryCollection _reportCategoryCollectionViaUserPermission;
		private bool	_alwaysFetchReportCategoryCollectionViaUserPermission, _alreadyFetchedReportCategoryCollectionViaUserPermission;
		private CARMSData.CollectionClasses.ReportFlowCollection _reportFlowCollectionViaReportHeader;
		private bool	_alwaysFetchReportFlowCollectionViaReportHeader, _alreadyFetchedReportFlowCollectionViaReportHeader;
		private CARMSData.CollectionClasses.ReportHeaderCollection _reportHeaderCollectionViaMessage;
		private bool	_alwaysFetchReportHeaderCollectionViaMessage, _alreadyFetchedReportHeaderCollectionViaMessage;
		private CARMSData.CollectionClasses.RoleCollection _roleCollectionViaUserRole;
		private bool	_alwaysFetchRoleCollectionViaUserRole, _alreadyFetchedRoleCollectionViaUserRole;
		private CARMSData.CollectionClasses.TemplateCollection _templateCollectionViaMessage;
		private bool	_alwaysFetchTemplateCollectionViaMessage, _alreadyFetchedTemplateCollectionViaMessage;


		
		// __LLBLGENPRO_USER_CODE_REGION_START PrivateMembers
		// __LLBLGENPRO_USER_CODE_REGION_END
		#endregion

		#region Statics
		private static Dictionary<string, string>	_customProperties;
		private static Dictionary<string, Dictionary<string, string>>	_fieldsCustomProperties;

		/// <summary>All names of fields mapped onto a relation. Usable for in-memory filtering</summary>
		public static partial class MemberNames
		{

			/// <summary>Member name Message</summary>
			public static readonly string Message = "Message";
			/// <summary>Member name ReportHeader</summary>
			public static readonly string ReportHeader = "ReportHeader";
			/// <summary>Member name UserAction</summary>
			public static readonly string UserAction = "UserAction";
			/// <summary>Member name UserPermission</summary>
			public static readonly string UserPermission = "UserPermission";
			/// <summary>Member name UserRole</summary>
			public static readonly string UserRole = "UserRole";
			/// <summary>Member name ActionCollectionViaUserAction</summary>
			public static readonly string ActionCollectionViaUserAction = "ActionCollectionViaUserAction";
			/// <summary>Member name ReportCategoryCollectionViaReportHeader</summary>
			public static readonly string ReportCategoryCollectionViaReportHeader = "ReportCategoryCollectionViaReportHeader";
			/// <summary>Member name ReportCategoryCollectionViaUserPermission</summary>
			public static readonly string ReportCategoryCollectionViaUserPermission = "ReportCategoryCollectionViaUserPermission";
			/// <summary>Member name ReportFlowCollectionViaReportHeader</summary>
			public static readonly string ReportFlowCollectionViaReportHeader = "ReportFlowCollectionViaReportHeader";
			/// <summary>Member name ReportHeaderCollectionViaMessage</summary>
			public static readonly string ReportHeaderCollectionViaMessage = "ReportHeaderCollectionViaMessage";
			/// <summary>Member name RoleCollectionViaUserRole</summary>
			public static readonly string RoleCollectionViaUserRole = "RoleCollectionViaUserRole";
			/// <summary>Member name TemplateCollectionViaMessage</summary>
			public static readonly string TemplateCollectionViaMessage = "TemplateCollectionViaMessage";

		}
		#endregion
		
		/// <summary>Static CTor for setting up custom property hashtables. Is executed before the first instance of this entity class or derived classes is constructed. </summary>
		static UserEntity()
		{
			SetupCustomPropertyHashtables();
		}

		/// <summary>CTor</summary>
		public UserEntity()
		{
			InitClassEmpty(null);
		}


		/// <summary>CTor</summary>
		/// <param name="userId">PK value for User which data should be fetched into this User object</param>
		public UserEntity(System.Int32 userId)
		{
			InitClassFetch(userId, null, null);
		}

		/// <summary>CTor</summary>
		/// <param name="userId">PK value for User which data should be fetched into this User object</param>
		/// <param name="prefetchPathToUse">the PrefetchPath which defines the graph of objects to fetch as well</param>
		public UserEntity(System.Int32 userId, IPrefetchPath prefetchPathToUse)
		{
			InitClassFetch(userId, null, prefetchPathToUse);
		}

		/// <summary>CTor</summary>
		/// <param name="userId">PK value for User which data should be fetched into this User object</param>
		/// <param name="validator">The custom validator object for this UserEntity</param>
		public UserEntity(System.Int32 userId, IValidator validator)
		{
			InitClassFetch(userId, validator, null);
		}


		/// <summary>Private CTor for deserialization</summary>
		/// <param name="info"></param>
		/// <param name="context"></param>
		protected UserEntity(SerializationInfo info, StreamingContext context) : base(info, context)
		{
			_message = (CARMSData.CollectionClasses.MessageCollection)info.GetValue("_message", typeof(CARMSData.CollectionClasses.MessageCollection));
			_alwaysFetchMessage = info.GetBoolean("_alwaysFetchMessage");
			_alreadyFetchedMessage = info.GetBoolean("_alreadyFetchedMessage");
			_reportHeader = (CARMSData.CollectionClasses.ReportHeaderCollection)info.GetValue("_reportHeader", typeof(CARMSData.CollectionClasses.ReportHeaderCollection));
			_alwaysFetchReportHeader = info.GetBoolean("_alwaysFetchReportHeader");
			_alreadyFetchedReportHeader = info.GetBoolean("_alreadyFetchedReportHeader");
			_userAction = (CARMSData.CollectionClasses.UserActionCollection)info.GetValue("_userAction", typeof(CARMSData.CollectionClasses.UserActionCollection));
			_alwaysFetchUserAction = info.GetBoolean("_alwaysFetchUserAction");
			_alreadyFetchedUserAction = info.GetBoolean("_alreadyFetchedUserAction");
			_userPermission = (CARMSData.CollectionClasses.UserPermissionCollection)info.GetValue("_userPermission", typeof(CARMSData.CollectionClasses.UserPermissionCollection));
			_alwaysFetchUserPermission = info.GetBoolean("_alwaysFetchUserPermission");
			_alreadyFetchedUserPermission = info.GetBoolean("_alreadyFetchedUserPermission");
			_userRole = (CARMSData.CollectionClasses.UserRoleCollection)info.GetValue("_userRole", typeof(CARMSData.CollectionClasses.UserRoleCollection));
			_alwaysFetchUserRole = info.GetBoolean("_alwaysFetchUserRole");
			_alreadyFetchedUserRole = info.GetBoolean("_alreadyFetchedUserRole");
			_actionCollectionViaUserAction = (CARMSData.CollectionClasses.ActionCollection)info.GetValue("_actionCollectionViaUserAction", typeof(CARMSData.CollectionClasses.ActionCollection));
			_alwaysFetchActionCollectionViaUserAction = info.GetBoolean("_alwaysFetchActionCollectionViaUserAction");
			_alreadyFetchedActionCollectionViaUserAction = info.GetBoolean("_alreadyFetchedActionCollectionViaUserAction");
			_reportCategoryCollectionViaReportHeader = (CARMSData.CollectionClasses.ReportCategoryCollection)info.GetValue("_reportCategoryCollectionViaReportHeader", typeof(CARMSData.CollectionClasses.ReportCategoryCollection));
			_alwaysFetchReportCategoryCollectionViaReportHeader = info.GetBoolean("_alwaysFetchReportCategoryCollectionViaReportHeader");
			_alreadyFetchedReportCategoryCollectionViaReportHeader = info.GetBoolean("_alreadyFetchedReportCategoryCollectionViaReportHeader");
			_reportCategoryCollectionViaUserPermission = (CARMSData.CollectionClasses.ReportCategoryCollection)info.GetValue("_reportCategoryCollectionViaUserPermission", typeof(CARMSData.CollectionClasses.ReportCategoryCollection));
			_alwaysFetchReportCategoryCollectionViaUserPermission = info.GetBoolean("_alwaysFetchReportCategoryCollectionViaUserPermission");
			_alreadyFetchedReportCategoryCollectionViaUserPermission = info.GetBoolean("_alreadyFetchedReportCategoryCollectionViaUserPermission");
			_reportFlowCollectionViaReportHeader = (CARMSData.CollectionClasses.ReportFlowCollection)info.GetValue("_reportFlowCollectionViaReportHeader", typeof(CARMSData.CollectionClasses.ReportFlowCollection));
			_alwaysFetchReportFlowCollectionViaReportHeader = info.GetBoolean("_alwaysFetchReportFlowCollectionViaReportHeader");
			_alreadyFetchedReportFlowCollectionViaReportHeader = info.GetBoolean("_alreadyFetchedReportFlowCollectionViaReportHeader");
			_reportHeaderCollectionViaMessage = (CARMSData.CollectionClasses.ReportHeaderCollection)info.GetValue("_reportHeaderCollectionViaMessage", typeof(CARMSData.CollectionClasses.ReportHeaderCollection));
			_alwaysFetchReportHeaderCollectionViaMessage = info.GetBoolean("_alwaysFetchReportHeaderCollectionViaMessage");
			_alreadyFetchedReportHeaderCollectionViaMessage = info.GetBoolean("_alreadyFetchedReportHeaderCollectionViaMessage");
			_roleCollectionViaUserRole = (CARMSData.CollectionClasses.RoleCollection)info.GetValue("_roleCollectionViaUserRole", typeof(CARMSData.CollectionClasses.RoleCollection));
			_alwaysFetchRoleCollectionViaUserRole = info.GetBoolean("_alwaysFetchRoleCollectionViaUserRole");
			_alreadyFetchedRoleCollectionViaUserRole = info.GetBoolean("_alreadyFetchedRoleCollectionViaUserRole");
			_templateCollectionViaMessage = (CARMSData.CollectionClasses.TemplateCollection)info.GetValue("_templateCollectionViaMessage", typeof(CARMSData.CollectionClasses.TemplateCollection));
			_alwaysFetchTemplateCollectionViaMessage = info.GetBoolean("_alwaysFetchTemplateCollectionViaMessage");
			_alreadyFetchedTemplateCollectionViaMessage = info.GetBoolean("_alreadyFetchedTemplateCollectionViaMessage");


			base.FixupDeserialization(FieldInfoProviderSingleton.GetInstance(), PersistenceInfoProviderSingleton.GetInstance());
			
			// __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
			// __LLBLGENPRO_USER_CODE_REGION_END
		}

		
		/// <summary>Performs the desync setup when an FK field has been changed. The entity referenced based on the FK field will be dereferenced and sync info will be removed.</summary>
		/// <param name="fieldIndex">The fieldindex.</param>
		protected override void PerformDesyncSetupFKFieldChange(int fieldIndex)
		{
			switch((UserFieldIndex)fieldIndex)
			{
				default:
					base.PerformDesyncSetupFKFieldChange(fieldIndex);
					break;
			}
		}
		
		/// <summary>Gets the inheritance info provider instance of the project this entity instance is located in. </summary>
		/// <returns>ready to use inheritance info provider instance.</returns>
		protected override IInheritanceInfoProvider GetInheritanceInfoProvider()
		{
			return InheritanceInfoProviderSingleton.GetInstance();
		}
		
		/// <summary> Will perform post-ReadXml actions</summary>
		protected override void PostReadXmlFixups()
		{
			_alreadyFetchedMessage = (_message.Count > 0);
			_alreadyFetchedReportHeader = (_reportHeader.Count > 0);
			_alreadyFetchedUserAction = (_userAction.Count > 0);
			_alreadyFetchedUserPermission = (_userPermission.Count > 0);
			_alreadyFetchedUserRole = (_userRole.Count > 0);
			_alreadyFetchedActionCollectionViaUserAction = (_actionCollectionViaUserAction.Count > 0);
			_alreadyFetchedReportCategoryCollectionViaReportHeader = (_reportCategoryCollectionViaReportHeader.Count > 0);
			_alreadyFetchedReportCategoryCollectionViaUserPermission = (_reportCategoryCollectionViaUserPermission.Count > 0);
			_alreadyFetchedReportFlowCollectionViaReportHeader = (_reportFlowCollectionViaReportHeader.Count > 0);
			_alreadyFetchedReportHeaderCollectionViaMessage = (_reportHeaderCollectionViaMessage.Count > 0);
			_alreadyFetchedRoleCollectionViaUserRole = (_roleCollectionViaUserRole.Count > 0);
			_alreadyFetchedTemplateCollectionViaMessage = (_templateCollectionViaMessage.Count > 0);


		}
				
		/// <summary>Gets the relation objects which represent the relation the fieldName specified is mapped on. </summary>
		/// <param name="fieldName">Name of the field mapped onto the relation of which the relation objects have to be obtained.</param>
		/// <returns>RelationCollection with relation object(s) which represent the relation the field is maped on</returns>
		public override RelationCollection GetRelationsForFieldOfType(string fieldName)
		{
			return UserEntity.GetRelationsForField(fieldName);
		}

		/// <summary>Gets the relation objects which represent the relation the fieldName specified is mapped on. </summary>
		/// <param name="fieldName">Name of the field mapped onto the relation of which the relation objects have to be obtained.</param>
		/// <returns>RelationCollection with relation object(s) which represent the relation the field is maped on</returns>
		public static RelationCollection GetRelationsForField(string fieldName)
		{
			RelationCollection toReturn = new RelationCollection();
			switch(fieldName)
			{

				case "Message":
					toReturn.Add(UserEntity.Relations.MessageEntityUsingTargetUserId);
					break;
				case "ReportHeader":
					toReturn.Add(UserEntity.Relations.ReportHeaderEntityUsingApplyUserId);
					break;
				case "UserAction":
					toReturn.Add(UserEntity.Relations.UserActionEntityUsingUserId);
					break;
				case "UserPermission":
					toReturn.Add(UserEntity.Relations.UserPermissionEntityUsingUserId);
					break;
				case "UserRole":
					toReturn.Add(UserEntity.Relations.UserRoleEntityUsingUserId);
					break;
				case "ActionCollectionViaUserAction":
					toReturn.Add(UserEntity.Relations.UserActionEntityUsingUserId, "UserEntity__", "UserAction_", JoinHint.None);
					toReturn.Add(UserActionEntity.Relations.ActionEntityUsingActionId, "UserAction_", string.Empty, JoinHint.None);
					break;
				case "ReportCategoryCollectionViaReportHeader":
					toReturn.Add(UserEntity.Relations.ReportHeaderEntityUsingApplyUserId, "UserEntity__", "ReportHeader_", JoinHint.None);
					toReturn.Add(ReportHeaderEntity.Relations.ReportCategoryEntityUsingReportCategoryId, "ReportHeader_", string.Empty, JoinHint.None);
					break;
				case "ReportCategoryCollectionViaUserPermission":
					toReturn.Add(UserEntity.Relations.UserPermissionEntityUsingUserId, "UserEntity__", "UserPermission_", JoinHint.None);
					toReturn.Add(UserPermissionEntity.Relations.ReportCategoryEntityUsingReportId, "UserPermission_", string.Empty, JoinHint.None);
					break;
				case "ReportFlowCollectionViaReportHeader":
					toReturn.Add(UserEntity.Relations.ReportHeaderEntityUsingApplyUserId, "UserEntity__", "ReportHeader_", JoinHint.None);
					toReturn.Add(ReportHeaderEntity.Relations.ReportFlowEntityUsingReportFlowId, "ReportHeader_", string.Empty, JoinHint.None);
					break;
				case "ReportHeaderCollectionViaMessage":
					toReturn.Add(UserEntity.Relations.MessageEntityUsingTargetUserId, "UserEntity__", "Message_", JoinHint.None);
					toReturn.Add(MessageEntity.Relations.ReportHeaderEntityUsingReportHeaderId, "Message_", string.Empty, JoinHint.None);
					break;
				case "RoleCollectionViaUserRole":
					toReturn.Add(UserEntity.Relations.UserRoleEntityUsingUserId, "UserEntity__", "UserRole_", JoinHint.None);
					toReturn.Add(UserRoleEntity.Relations.RoleEntityUsingRoleId, "UserRole_", string.Empty, JoinHint.None);
					break;
				case "TemplateCollectionViaMessage":
					toReturn.Add(UserEntity.Relations.MessageEntityUsingTargetUserId, "UserEntity__", "Message_", JoinHint.None);
					toReturn.Add(MessageEntity.Relations.TemplateEntityUsingTemplateId, "Message_", string.Empty, JoinHint.None);
					break;

				default:

					break;				
			}
			return toReturn;
		}



		/// <summary> ISerializable member. Does custom serialization so event handlers do not get serialized.
		/// Serializes members of this entity class and uses the base class' implementation to serialize the rest.</summary>
		/// <param name="info"></param>
		/// <param name="context"></param>
		[EditorBrowsable(EditorBrowsableState.Never)]
		public override void GetObjectData(SerializationInfo info, StreamingContext context)
		{
			info.AddValue("_message", (!this.MarkedForDeletion?_message:null));
			info.AddValue("_alwaysFetchMessage", _alwaysFetchMessage);
			info.AddValue("_alreadyFetchedMessage", _alreadyFetchedMessage);
			info.AddValue("_reportHeader", (!this.MarkedForDeletion?_reportHeader:null));
			info.AddValue("_alwaysFetchReportHeader", _alwaysFetchReportHeader);
			info.AddValue("_alreadyFetchedReportHeader", _alreadyFetchedReportHeader);
			info.AddValue("_userAction", (!this.MarkedForDeletion?_userAction:null));
			info.AddValue("_alwaysFetchUserAction", _alwaysFetchUserAction);
			info.AddValue("_alreadyFetchedUserAction", _alreadyFetchedUserAction);
			info.AddValue("_userPermission", (!this.MarkedForDeletion?_userPermission:null));
			info.AddValue("_alwaysFetchUserPermission", _alwaysFetchUserPermission);
			info.AddValue("_alreadyFetchedUserPermission", _alreadyFetchedUserPermission);
			info.AddValue("_userRole", (!this.MarkedForDeletion?_userRole:null));
			info.AddValue("_alwaysFetchUserRole", _alwaysFetchUserRole);
			info.AddValue("_alreadyFetchedUserRole", _alreadyFetchedUserRole);
			info.AddValue("_actionCollectionViaUserAction", (!this.MarkedForDeletion?_actionCollectionViaUserAction:null));
			info.AddValue("_alwaysFetchActionCollectionViaUserAction", _alwaysFetchActionCollectionViaUserAction);
			info.AddValue("_alreadyFetchedActionCollectionViaUserAction", _alreadyFetchedActionCollectionViaUserAction);
			info.AddValue("_reportCategoryCollectionViaReportHeader", (!this.MarkedForDeletion?_reportCategoryCollectionViaReportHeader:null));
			info.AddValue("_alwaysFetchReportCategoryCollectionViaReportHeader", _alwaysFetchReportCategoryCollectionViaReportHeader);
			info.AddValue("_alreadyFetchedReportCategoryCollectionViaReportHeader", _alreadyFetchedReportCategoryCollectionViaReportHeader);
			info.AddValue("_reportCategoryCollectionViaUserPermission", (!this.MarkedForDeletion?_reportCategoryCollectionViaUserPermission:null));
			info.AddValue("_alwaysFetchReportCategoryCollectionViaUserPermission", _alwaysFetchReportCategoryCollectionViaUserPermission);
			info.AddValue("_alreadyFetchedReportCategoryCollectionViaUserPermission", _alreadyFetchedReportCategoryCollectionViaUserPermission);
			info.AddValue("_reportFlowCollectionViaReportHeader", (!this.MarkedForDeletion?_reportFlowCollectionViaReportHeader:null));
			info.AddValue("_alwaysFetchReportFlowCollectionViaReportHeader", _alwaysFetchReportFlowCollectionViaReportHeader);
			info.AddValue("_alreadyFetchedReportFlowCollectionViaReportHeader", _alreadyFetchedReportFlowCollectionViaReportHeader);
			info.AddValue("_reportHeaderCollectionViaMessage", (!this.MarkedForDeletion?_reportHeaderCollectionViaMessage:null));
			info.AddValue("_alwaysFetchReportHeaderCollectionViaMessage", _alwaysFetchReportHeaderCollectionViaMessage);
			info.AddValue("_alreadyFetchedReportHeaderCollectionViaMessage", _alreadyFetchedReportHeaderCollectionViaMessage);
			info.AddValue("_roleCollectionViaUserRole", (!this.MarkedForDeletion?_roleCollectionViaUserRole:null));
			info.AddValue("_alwaysFetchRoleCollectionViaUserRole", _alwaysFetchRoleCollectionViaUserRole);
			info.AddValue("_alreadyFetchedRoleCollectionViaUserRole", _alreadyFetchedRoleCollectionViaUserRole);
			info.AddValue("_templateCollectionViaMessage", (!this.MarkedForDeletion?_templateCollectionViaMessage:null));
			info.AddValue("_alwaysFetchTemplateCollectionViaMessage", _alwaysFetchTemplateCollectionViaMessage);
			info.AddValue("_alreadyFetchedTemplateCollectionViaMessage", _alreadyFetchedTemplateCollectionViaMessage);


			
			// __LLBLGENPRO_USER_CODE_REGION_START GetObjectInfo
			// __LLBLGENPRO_USER_CODE_REGION_END
			base.GetObjectData(info, context);
		}
		
		/// <summary> Sets the related entity property to the entity specified. If the property is a collection, it will add the entity specified to that collection.</summary>
		/// <param name="propertyName">Name of the property.</param>
		/// <param name="entity">Entity to set as an related entity</param>
		/// <remarks>Used by prefetch path logic.</remarks>
		[EditorBrowsable(EditorBrowsableState.Never)]
		public override void SetRelatedEntityProperty(string propertyName, IEntity entity)
		{
			switch(propertyName)
			{

				case "Message":
					_alreadyFetchedMessage = true;
					if(entity!=null)
					{
						this.Message.Add((MessageEntity)entity);
					}
					break;
				case "ReportHeader":
					_alreadyFetchedReportHeader = true;
					if(entity!=null)
					{
						this.ReportHeader.Add((ReportHeaderEntity)entity);
					}
					break;
				case "UserAction":
					_alreadyFetchedUserAction = true;
					if(entity!=null)
					{
						this.UserAction.Add((UserActionEntity)entity);
					}
					break;
				case "UserPermission":
					_alreadyFetchedUserPermission = true;
					if(entity!=null)
					{
						this.UserPermission.Add((UserPermissionEntity)entity);
					}
					break;
				case "UserRole":
					_alreadyFetchedUserRole = true;
					if(entity!=null)
					{
						this.UserRole.Add((UserRoleEntity)entity);
					}
					break;
				case "ActionCollectionViaUserAction":
					_alreadyFetchedActionCollectionViaUserAction = true;
					if(entity!=null)
					{
						this.ActionCollectionViaUserAction.Add((ActionEntity)entity);
					}
					break;
				case "ReportCategoryCollectionViaReportHeader":
					_alreadyFetchedReportCategoryCollectionViaReportHeader = true;
					if(entity!=null)
					{
						this.ReportCategoryCollectionViaReportHeader.Add((ReportCategoryEntity)entity);
					}
					break;
				case "ReportCategoryCollectionViaUserPermission":
					_alreadyFetchedReportCategoryCollectionViaUserPermission = true;
					if(entity!=null)
					{
						this.ReportCategoryCollectionViaUserPermission.Add((ReportCategoryEntity)entity);
					}
					break;
				case "ReportFlowCollectionViaReportHeader":
					_alreadyFetchedReportFlowCollectionViaReportHeader = true;
					if(entity!=null)
					{
						this.ReportFlowCollectionViaReportHeader.Add((ReportFlowEntity)entity);
					}
					break;
				case "ReportHeaderCollectionViaMessage":
					_alreadyFetchedReportHeaderCollectionViaMessage = true;
					if(entity!=null)
					{
						this.ReportHeaderCollectionViaMessage.Add((ReportHeaderEntity)entity);
					}
					break;
				case "RoleCollectionViaUserRole":
					_alreadyFetchedRoleCollectionViaUserRole = true;
					if(entity!=null)
					{
						this.RoleCollectionViaUserRole.Add((RoleEntity)entity);
					}
					break;
				case "TemplateCollectionViaMessage":
					_alreadyFetchedTemplateCollectionViaMessage = true;
					if(entity!=null)
					{
						this.TemplateCollectionViaMessage.Add((TemplateEntity)entity);
					}
					break;

				default:

					break;
			}
		}

		/// <summary> Sets the internal parameter related to the fieldname passed to the instance relatedEntity. </summary>
		/// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
		/// <param name="fieldName">Name of field mapped onto the relation which resolves in the instance relatedEntity</param>
		[EditorBrowsable(EditorBrowsableState.Never)]
		public override void SetRelatedEntity(IEntity relatedEntity, string fieldName)
		{
			switch(fieldName)
			{

				case "Message":
					_message.Add((MessageEntity)relatedEntity);
					break;
				case "ReportHeader":
					_reportHeader.Add((ReportHeaderEntity)relatedEntity);
					break;
				case "UserAction":
					_userAction.Add((UserActionEntity)relatedEntity);
					break;
				case "UserPermission":
					_userPermission.Add((UserPermissionEntity)relatedEntity);
					break;
				case "UserRole":
					_userRole.Add((UserRoleEntity)relatedEntity);
					break;

				default:

					break;
			}
		}
		
		/// <summary> Unsets the internal parameter related to the fieldname passed to the instance relatedEntity. Reverses the actions taken by SetRelatedEntity() </summary>
		/// <param name="relatedEntity">Instance to unset as the related entity of type entityType</param>
		/// <param name="fieldName">Name of field mapped onto the relation which resolves in the instance relatedEntity</param>
		/// <param name="signalRelatedEntityManyToOne">if set to true it will notify the manytoone side, if applicable.</param>
		[EditorBrowsable(EditorBrowsableState.Never)]
		public override void UnsetRelatedEntity(IEntity relatedEntity, string fieldName, bool signalRelatedEntityManyToOne)
		{
			switch(fieldName)
			{

				case "Message":
					base.PerformRelatedEntityRemoval(_message, relatedEntity, signalRelatedEntityManyToOne);
					break;
				case "ReportHeader":
					base.PerformRelatedEntityRemoval(_reportHeader, relatedEntity, signalRelatedEntityManyToOne);
					break;
				case "UserAction":
					base.PerformRelatedEntityRemoval(_userAction, relatedEntity, signalRelatedEntityManyToOne);
					break;
				case "UserPermission":
					base.PerformRelatedEntityRemoval(_userPermission, relatedEntity, signalRelatedEntityManyToOne);
					break;
				case "UserRole":
					base.PerformRelatedEntityRemoval(_userRole, relatedEntity, signalRelatedEntityManyToOne);
					break;

				default:

					break;
			}
		}

		/// <summary> Gets a collection of related entities referenced by this entity which depend on this entity (this entity is the PK side of their FK fields). These
		/// entities will have to be persisted after this entity during a recursive save.</summary>
		/// <returns>Collection with 0 or more IEntity objects, referenced by this entity</returns>
		public override List<IEntity> GetDependingRelatedEntities()
		{
			List<IEntity> toReturn = new List<IEntity>();


			return toReturn;
		}
		
		/// <summary> Gets a collection of related entities referenced by this entity which this entity depends on (this entity is the FK side of their PK fields). These
		/// entities will have to be persisted before this entity during a recursive save.</summary>
		/// <returns>Collection with 0 or more IEntity objects, referenced by this entity</returns>
		public override List<IEntity> GetDependentRelatedEntities()
		{
			List<IEntity> toReturn = new List<IEntity>();



			return toReturn;
		}
		
		/// <summary> Gets a List of all entity collections stored as member variables in this entity. The contents of the ArrayList is
		/// used by the DataAccessAdapter to perform recursive saves. Only 1:n related collections are returned.</summary>
		/// <returns>Collection with 0 or more IEntityCollection objects, referenced by this entity</returns>
		public override List<IEntityCollection> GetMemberEntityCollections()
		{
			List<IEntityCollection> toReturn = new List<IEntityCollection>();
			toReturn.Add(_message);
			toReturn.Add(_reportHeader);
			toReturn.Add(_userAction);
			toReturn.Add(_userPermission);
			toReturn.Add(_userRole);

			return toReturn;
		}

		

		

		/// <summary> Fetches the contents of this entity from the persistent storage using the primary key.</summary>
		/// <param name="userId">PK value for User which data should be fetched into this User object</param>
		/// <returns>True if succeeded, false otherwise.</returns>
		public bool FetchUsingPK(System.Int32 userId)
		{
			return FetchUsingPK(userId, null, null, null);
		}

		/// <summary> Fetches the contents of this entity from the persistent storage using the primary key.</summary>
		/// <param name="userId">PK value for User which data should be fetched into this User object</param>
		/// <param name="prefetchPathToUse">the PrefetchPath which defines the graph of objects to fetch as well</param>
		/// <returns>True if succeeded, false otherwise.</returns>
		public bool FetchUsingPK(System.Int32 userId, IPrefetchPath prefetchPathToUse)
		{
			return FetchUsingPK(userId, prefetchPathToUse, null, null);
		}

		/// <summary> Fetches the contents of this entity from the persistent storage using the primary key.</summary>
		/// <param name="userId">PK value for User which data should be fetched into this User object</param>
		/// <param name="prefetchPathToUse">the PrefetchPath which defines the graph of objects to fetch as well</param>
		/// <param name="contextToUse">The context to add the entity to if the fetch was succesful. </param>
		/// <returns>True if succeeded, false otherwise.</returns>
		public bool FetchUsingPK(System.Int32 userId, IPrefetchPath prefetchPathToUse, Context contextToUse)
		{
			return Fetch(userId, prefetchPathToUse, contextToUse, null);
		}

		/// <summary> Fetches the contents of this entity from the persistent storage using the primary key.</summary>
		/// <param name="userId">PK value for User which data should be fetched into this User object</param>
		/// <param name="prefetchPathToUse">the PrefetchPath which defines the graph of objects to fetch as well</param>
		/// <param name="contextToUse">The context to add the entity to if the fetch was succesful. </param>
		/// <param name="excludedIncludedFields">The list of IEntityField objects which have to be excluded or included for the fetch. 
		/// If null or empty, all fields are fetched (default). If an instance of ExcludeIncludeFieldsList is passed in and its ExcludeContainedFields property
		/// is set to false, the fields contained in excludedIncludedFields are kept in the query, the rest of the fields in the query are excluded.</param>
		/// <returns>True if succeeded, false otherwise.</returns>
		public bool FetchUsingPK(System.Int32 userId, IPrefetchPath prefetchPathToUse, Context contextToUse, ExcludeIncludeFieldsList excludedIncludedFields)
		{
			return Fetch(userId, prefetchPathToUse, contextToUse, excludedIncludedFields);
		}

		/// <summary> Refetches the Entity from the persistent storage. Refetch is used to re-load an Entity which is marked "Out-of-sync", due to a save action. 
		/// Refetching an empty Entity has no effect. </summary>
		/// <returns>true if Refetch succeeded, false otherwise</returns>
		public override bool Refetch()
		{
			return Fetch(this.UserId, null, null, null);
		}

		/// <summary> Returns true if the original value for the field with the fieldIndex passed in, read from the persistent storage was NULL, false otherwise.
		/// Should not be used for testing if the current value is NULL, use <see cref="TestCurrentFieldValueForNull"/> for that.</summary>
		/// <param name="fieldIndex">Index of the field to test if that field was NULL in the persistent storage</param>
		/// <returns>true if the field with the passed in index was NULL in the persistent storage, false otherwise</returns>
		public bool TestOriginalFieldValueForNull(UserFieldIndex fieldIndex)
		{
			return base.Fields[(int)fieldIndex].IsNull;
		}
		
		/// <summary>Returns true if the current value for the field with the fieldIndex passed in represents null/not defined, false otherwise.
		/// Should not be used for testing if the original value (read from the db) is NULL</summary>
		/// <param name="fieldIndex">Index of the field to test if its currentvalue is null/undefined</param>
		/// <returns>true if the field's value isn't defined yet, false otherwise</returns>
		public bool TestCurrentFieldValueForNull(UserFieldIndex fieldIndex)
		{
			return base.CheckIfCurrentFieldValueIsNull((int)fieldIndex);
		}

				
		/// <summary>Gets a list of all the EntityRelation objects the type of this instance has.</summary>
		/// <returns>A list of all the EntityRelation objects the type of this instance has. Hierarchy relations are excluded.</returns>
		public override List<IEntityRelation> GetAllRelations()
		{
			return new UserRelations().GetAllRelations();
		}


		/// <summary> Retrieves all related entities of type 'MessageEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <returns>Filled collection with all related entities of type 'MessageEntity'</returns>
		public CARMSData.CollectionClasses.MessageCollection GetMultiMessage(bool forceFetch)
		{
			return GetMultiMessage(forceFetch, _message.EntityFactoryToUse, null);
		}

		/// <summary> Retrieves all related entities of type 'MessageEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="filter">Extra filter to limit the resultset.</param>
		/// <returns>Filled collection with all related entities of type 'MessageEntity'</returns>
		public CARMSData.CollectionClasses.MessageCollection GetMultiMessage(bool forceFetch, IPredicateExpression filter)
		{
			return GetMultiMessage(forceFetch, _message.EntityFactoryToUse, filter);
		}

		/// <summary> Retrieves all related entities of type 'MessageEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="entityFactoryToUse">The entity factory to use for the GetMultiManyToOne() routine.</param>
		/// <returns>Filled collection with all related entities of the type constructed by the passed in entity factory</returns>
		public CARMSData.CollectionClasses.MessageCollection GetMultiMessage(bool forceFetch, IEntityFactory entityFactoryToUse)
		{
			return GetMultiMessage(forceFetch, entityFactoryToUse, null);
		}

		/// <summary> Retrieves all related entities of type 'MessageEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="entityFactoryToUse">The entity factory to use for the GetMultiManyToOne() routine.</param>
		/// <param name="filter">Extra filter to limit the resultset.</param>
		/// <returns>Filled collection with all related entities of the type constructed by the passed in entity factory</returns>
		public virtual CARMSData.CollectionClasses.MessageCollection GetMultiMessage(bool forceFetch, IEntityFactory entityFactoryToUse, IPredicateExpression filter)
		{
 			if( ( !_alreadyFetchedMessage || forceFetch || _alwaysFetchMessage) && !base.IsSerializing && !base.IsDeserializing && !base.InDesignMode)
			{
				if(base.ParticipatesInTransaction)
				{
					if(!_message.ParticipatesInTransaction)
					{
						base.Transaction.Add(_message);
					}
				}
				_message.SuppressClearInGetMulti=!forceFetch;
				if(entityFactoryToUse!=null)
				{
					_message.EntityFactoryToUse = entityFactoryToUse;
				}
				_message.GetMultiManyToOne(null, null, this, filter);
				_message.SuppressClearInGetMulti=false;
				_alreadyFetchedMessage = true;
			}
			return _message;
		}

		/// <summary> Sets the collection parameters for the collection for 'Message'. These settings will be taken into account
		/// when the property Message is requested or GetMultiMessage is called.</summary>
		/// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return. When set to 0, this parameter is ignored</param>
		/// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified (null), no sorting is applied.</param>
		public virtual void SetCollectionParametersMessage(long maxNumberOfItemsToReturn, ISortExpression sortClauses)
		{
			_message.SortClauses=sortClauses;
			_message.MaxNumberOfItemsToReturn=maxNumberOfItemsToReturn;
		}

		/// <summary> Retrieves all related entities of type 'ReportHeaderEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <returns>Filled collection with all related entities of type 'ReportHeaderEntity'</returns>
		public CARMSData.CollectionClasses.ReportHeaderCollection GetMultiReportHeader(bool forceFetch)
		{
			return GetMultiReportHeader(forceFetch, _reportHeader.EntityFactoryToUse, null);
		}

		/// <summary> Retrieves all related entities of type 'ReportHeaderEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="filter">Extra filter to limit the resultset.</param>
		/// <returns>Filled collection with all related entities of type 'ReportHeaderEntity'</returns>
		public CARMSData.CollectionClasses.ReportHeaderCollection GetMultiReportHeader(bool forceFetch, IPredicateExpression filter)
		{
			return GetMultiReportHeader(forceFetch, _reportHeader.EntityFactoryToUse, filter);
		}

		/// <summary> Retrieves all related entities of type 'ReportHeaderEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="entityFactoryToUse">The entity factory to use for the GetMultiManyToOne() routine.</param>
		/// <returns>Filled collection with all related entities of the type constructed by the passed in entity factory</returns>
		public CARMSData.CollectionClasses.ReportHeaderCollection GetMultiReportHeader(bool forceFetch, IEntityFactory entityFactoryToUse)
		{
			return GetMultiReportHeader(forceFetch, entityFactoryToUse, null);
		}

		/// <summary> Retrieves all related entities of type 'ReportHeaderEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="entityFactoryToUse">The entity factory to use for the GetMultiManyToOne() routine.</param>
		/// <param name="filter">Extra filter to limit the resultset.</param>
		/// <returns>Filled collection with all related entities of the type constructed by the passed in entity factory</returns>
		public virtual CARMSData.CollectionClasses.ReportHeaderCollection GetMultiReportHeader(bool forceFetch, IEntityFactory entityFactoryToUse, IPredicateExpression filter)
		{
 			if( ( !_alreadyFetchedReportHeader || forceFetch || _alwaysFetchReportHeader) && !base.IsSerializing && !base.IsDeserializing && !base.InDesignMode)
			{
				if(base.ParticipatesInTransaction)
				{
					if(!_reportHeader.ParticipatesInTransaction)
					{
						base.Transaction.Add(_reportHeader);
					}
				}
				_reportHeader.SuppressClearInGetMulti=!forceFetch;
				if(entityFactoryToUse!=null)
				{
					_reportHeader.EntityFactoryToUse = entityFactoryToUse;
				}
				_reportHeader.GetMultiManyToOne(null, null, this, filter);
				_reportHeader.SuppressClearInGetMulti=false;
				_alreadyFetchedReportHeader = true;
			}
			return _reportHeader;
		}

		/// <summary> Sets the collection parameters for the collection for 'ReportHeader'. These settings will be taken into account
		/// when the property ReportHeader is requested or GetMultiReportHeader is called.</summary>
		/// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return. When set to 0, this parameter is ignored</param>
		/// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified (null), no sorting is applied.</param>
		public virtual void SetCollectionParametersReportHeader(long maxNumberOfItemsToReturn, ISortExpression sortClauses)
		{
			_reportHeader.SortClauses=sortClauses;
			_reportHeader.MaxNumberOfItemsToReturn=maxNumberOfItemsToReturn;
		}

		/// <summary> Retrieves all related entities of type 'UserActionEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <returns>Filled collection with all related entities of type 'UserActionEntity'</returns>
		public CARMSData.CollectionClasses.UserActionCollection GetMultiUserAction(bool forceFetch)
		{
			return GetMultiUserAction(forceFetch, _userAction.EntityFactoryToUse, null);
		}

		/// <summary> Retrieves all related entities of type 'UserActionEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="filter">Extra filter to limit the resultset.</param>
		/// <returns>Filled collection with all related entities of type 'UserActionEntity'</returns>
		public CARMSData.CollectionClasses.UserActionCollection GetMultiUserAction(bool forceFetch, IPredicateExpression filter)
		{
			return GetMultiUserAction(forceFetch, _userAction.EntityFactoryToUse, filter);
		}

		/// <summary> Retrieves all related entities of type 'UserActionEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="entityFactoryToUse">The entity factory to use for the GetMultiManyToOne() routine.</param>
		/// <returns>Filled collection with all related entities of the type constructed by the passed in entity factory</returns>
		public CARMSData.CollectionClasses.UserActionCollection GetMultiUserAction(bool forceFetch, IEntityFactory entityFactoryToUse)
		{
			return GetMultiUserAction(forceFetch, entityFactoryToUse, null);
		}

		/// <summary> Retrieves all related entities of type 'UserActionEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="entityFactoryToUse">The entity factory to use for the GetMultiManyToOne() routine.</param>
		/// <param name="filter">Extra filter to limit the resultset.</param>
		/// <returns>Filled collection with all related entities of the type constructed by the passed in entity factory</returns>
		public virtual CARMSData.CollectionClasses.UserActionCollection GetMultiUserAction(bool forceFetch, IEntityFactory entityFactoryToUse, IPredicateExpression filter)
		{
 			if( ( !_alreadyFetchedUserAction || forceFetch || _alwaysFetchUserAction) && !base.IsSerializing && !base.IsDeserializing && !base.InDesignMode)
			{
				if(base.ParticipatesInTransaction)
				{
					if(!_userAction.ParticipatesInTransaction)
					{
						base.Transaction.Add(_userAction);
					}
				}
				_userAction.SuppressClearInGetMulti=!forceFetch;
				if(entityFactoryToUse!=null)
				{
					_userAction.EntityFactoryToUse = entityFactoryToUse;
				}
				_userAction.GetMultiManyToOne(null, this, filter);
				_userAction.SuppressClearInGetMulti=false;
				_alreadyFetchedUserAction = true;
			}
			return _userAction;
		}

		/// <summary> Sets the collection parameters for the collection for 'UserAction'. These settings will be taken into account
		/// when the property UserAction is requested or GetMultiUserAction is called.</summary>
		/// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return. When set to 0, this parameter is ignored</param>
		/// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified (null), no sorting is applied.</param>
		public virtual void SetCollectionParametersUserAction(long maxNumberOfItemsToReturn, ISortExpression sortClauses)
		{
			_userAction.SortClauses=sortClauses;
			_userAction.MaxNumberOfItemsToReturn=maxNumberOfItemsToReturn;
		}

		/// <summary> Retrieves all related entities of type 'UserPermissionEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <returns>Filled collection with all related entities of type 'UserPermissionEntity'</returns>
		public CARMSData.CollectionClasses.UserPermissionCollection GetMultiUserPermission(bool forceFetch)
		{
			return GetMultiUserPermission(forceFetch, _userPermission.EntityFactoryToUse, null);
		}

		/// <summary> Retrieves all related entities of type 'UserPermissionEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="filter">Extra filter to limit the resultset.</param>
		/// <returns>Filled collection with all related entities of type 'UserPermissionEntity'</returns>
		public CARMSData.CollectionClasses.UserPermissionCollection GetMultiUserPermission(bool forceFetch, IPredicateExpression filter)
		{
			return GetMultiUserPermission(forceFetch, _userPermission.EntityFactoryToUse, filter);
		}

		/// <summary> Retrieves all related entities of type 'UserPermissionEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="entityFactoryToUse">The entity factory to use for the GetMultiManyToOne() routine.</param>
		/// <returns>Filled collection with all related entities of the type constructed by the passed in entity factory</returns>
		public CARMSData.CollectionClasses.UserPermissionCollection GetMultiUserPermission(bool forceFetch, IEntityFactory entityFactoryToUse)
		{
			return GetMultiUserPermission(forceFetch, entityFactoryToUse, null);
		}

		/// <summary> Retrieves all related entities of type 'UserPermissionEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="entityFactoryToUse">The entity factory to use for the GetMultiManyToOne() routine.</param>
		/// <param name="filter">Extra filter to limit the resultset.</param>
		/// <returns>Filled collection with all related entities of the type constructed by the passed in entity factory</returns>
		public virtual CARMSData.CollectionClasses.UserPermissionCollection GetMultiUserPermission(bool forceFetch, IEntityFactory entityFactoryToUse, IPredicateExpression filter)
		{
 			if( ( !_alreadyFetchedUserPermission || forceFetch || _alwaysFetchUserPermission) && !base.IsSerializing && !base.IsDeserializing && !base.InDesignMode)
			{
				if(base.ParticipatesInTransaction)
				{
					if(!_userPermission.ParticipatesInTransaction)
					{
						base.Transaction.Add(_userPermission);
					}
				}
				_userPermission.SuppressClearInGetMulti=!forceFetch;
				if(entityFactoryToUse!=null)
				{
					_userPermission.EntityFactoryToUse = entityFactoryToUse;
				}
				_userPermission.GetMultiManyToOne(null, this, filter);
				_userPermission.SuppressClearInGetMulti=false;
				_alreadyFetchedUserPermission = true;
			}
			return _userPermission;
		}

		/// <summary> Sets the collection parameters for the collection for 'UserPermission'. These settings will be taken into account
		/// when the property UserPermission is requested or GetMultiUserPermission is called.</summary>
		/// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return. When set to 0, this parameter is ignored</param>
		/// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified (null), no sorting is applied.</param>
		public virtual void SetCollectionParametersUserPermission(long maxNumberOfItemsToReturn, ISortExpression sortClauses)
		{
			_userPermission.SortClauses=sortClauses;
			_userPermission.MaxNumberOfItemsToReturn=maxNumberOfItemsToReturn;
		}

		/// <summary> Retrieves all related entities of type 'UserRoleEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <returns>Filled collection with all related entities of type 'UserRoleEntity'</returns>
		public CARMSData.CollectionClasses.UserRoleCollection GetMultiUserRole(bool forceFetch)
		{
			return GetMultiUserRole(forceFetch, _userRole.EntityFactoryToUse, null);
		}

		/// <summary> Retrieves all related entities of type 'UserRoleEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="filter">Extra filter to limit the resultset.</param>
		/// <returns>Filled collection with all related entities of type 'UserRoleEntity'</returns>
		public CARMSData.CollectionClasses.UserRoleCollection GetMultiUserRole(bool forceFetch, IPredicateExpression filter)
		{
			return GetMultiUserRole(forceFetch, _userRole.EntityFactoryToUse, filter);
		}

		/// <summary> Retrieves all related entities of type 'UserRoleEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="entityFactoryToUse">The entity factory to use for the GetMultiManyToOne() routine.</param>
		/// <returns>Filled collection with all related entities of the type constructed by the passed in entity factory</returns>
		public CARMSData.CollectionClasses.UserRoleCollection GetMultiUserRole(bool forceFetch, IEntityFactory entityFactoryToUse)
		{
			return GetMultiUserRole(forceFetch, entityFactoryToUse, null);
		}

		/// <summary> Retrieves all related entities of type 'UserRoleEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="entityFactoryToUse">The entity factory to use for the GetMultiManyToOne() routine.</param>
		/// <param name="filter">Extra filter to limit the resultset.</param>
		/// <returns>Filled collection with all related entities of the type constructed by the passed in entity factory</returns>
		public virtual CARMSData.CollectionClasses.UserRoleCollection GetMultiUserRole(bool forceFetch, IEntityFactory entityFactoryToUse, IPredicateExpression filter)
		{
 			if( ( !_alreadyFetchedUserRole || forceFetch || _alwaysFetchUserRole) && !base.IsSerializing && !base.IsDeserializing && !base.InDesignMode)
			{
				if(base.ParticipatesInTransaction)
				{
					if(!_userRole.ParticipatesInTransaction)
					{
						base.Transaction.Add(_userRole);
					}
				}
				_userRole.SuppressClearInGetMulti=!forceFetch;
				if(entityFactoryToUse!=null)
				{
					_userRole.EntityFactoryToUse = entityFactoryToUse;
				}
				_userRole.GetMultiManyToOne(null, this, filter);
				_userRole.SuppressClearInGetMulti=false;
				_alreadyFetchedUserRole = true;
			}
			return _userRole;
		}

		/// <summary> Sets the collection parameters for the collection for 'UserRole'. These settings will be taken into account
		/// when the property UserRole is requested or GetMultiUserRole is called.</summary>
		/// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return. When set to 0, this parameter is ignored</param>
		/// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified (null), no sorting is applied.</param>
		public virtual void SetCollectionParametersUserRole(long maxNumberOfItemsToReturn, ISortExpression sortClauses)
		{
			_userRole.SortClauses=sortClauses;
			_userRole.MaxNumberOfItemsToReturn=maxNumberOfItemsToReturn;
		}

		/// <summary> Retrieves all related entities of type 'ActionEntity' using a relation of type 'm:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <returns>Filled collection with all related entities of type 'ActionEntity'</returns>
		public CARMSData.CollectionClasses.ActionCollection GetMultiActionCollectionViaUserAction(bool forceFetch)
		{
			return GetMultiActionCollectionViaUserAction(forceFetch, _actionCollectionViaUserAction.EntityFactoryToUse);
		}

		/// <summary> Retrieves all related entities of type 'ActionEntity' using a relation of type 'm:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="entityFactoryToUse">The entity factory to use for the GetMultiManyToMany() routine.</param>
		/// <returns>Filled collection with all related entities of the type constructed by the passed in entity factory</returns>
		public CARMSData.CollectionClasses.ActionCollection GetMultiActionCollectionViaUserAction(bool forceFetch, IEntityFactory entityFactoryToUse)
		{
 			if( ( !_alreadyFetchedActionCollectionViaUserAction || forceFetch || _alwaysFetchActionCollectionViaUserAction) && !base.IsSerializing && !base.IsDeserializing && !base.InDesignMode)
			{
				if(base.ParticipatesInTransaction)
				{
					if(!_actionCollectionViaUserAction.ParticipatesInTransaction)
					{
						base.Transaction.Add(_actionCollectionViaUserAction);
					}
				}
				IPredicateExpression filter = new PredicateExpression();
				filter.Add(new FieldCompareValuePredicate(UserFields.UserId, ComparisonOperator.Equal, this.UserId, "UserEntity__"));
				_actionCollectionViaUserAction.SuppressClearInGetMulti=!forceFetch;
				if(entityFactoryToUse!=null)
				{
					_actionCollectionViaUserAction.EntityFactoryToUse = entityFactoryToUse;
				}
				_actionCollectionViaUserAction.GetMulti(filter, GetRelationsForField("ActionCollectionViaUserAction"));
				_actionCollectionViaUserAction.SuppressClearInGetMulti=false;
				_alreadyFetchedActionCollectionViaUserAction = true;
			}
			return _actionCollectionViaUserAction;
		}

		/// <summary> Sets the collection parameters for the collection for 'ActionCollectionViaUserAction'. These settings will be taken into account
		/// when the property ActionCollectionViaUserAction is requested or GetMultiActionCollectionViaUserAction is called.</summary>
		/// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return. When set to 0, this parameter is ignored</param>
		/// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified (null), no sorting is applied.</param>
		public virtual void SetCollectionParametersActionCollectionViaUserAction(long maxNumberOfItemsToReturn, ISortExpression sortClauses)
		{
			_actionCollectionViaUserAction.SortClauses=sortClauses;
			_actionCollectionViaUserAction.MaxNumberOfItemsToReturn=maxNumberOfItemsToReturn;
		}

		/// <summary> Retrieves all related entities of type 'ReportCategoryEntity' using a relation of type 'm:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <returns>Filled collection with all related entities of type 'ReportCategoryEntity'</returns>
		public CARMSData.CollectionClasses.ReportCategoryCollection GetMultiReportCategoryCollectionViaReportHeader(bool forceFetch)
		{
			return GetMultiReportCategoryCollectionViaReportHeader(forceFetch, _reportCategoryCollectionViaReportHeader.EntityFactoryToUse);
		}

		/// <summary> Retrieves all related entities of type 'ReportCategoryEntity' using a relation of type 'm:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="entityFactoryToUse">The entity factory to use for the GetMultiManyToMany() routine.</param>
		/// <returns>Filled collection with all related entities of the type constructed by the passed in entity factory</returns>
		public CARMSData.CollectionClasses.ReportCategoryCollection GetMultiReportCategoryCollectionViaReportHeader(bool forceFetch, IEntityFactory entityFactoryToUse)
		{
 			if( ( !_alreadyFetchedReportCategoryCollectionViaReportHeader || forceFetch || _alwaysFetchReportCategoryCollectionViaReportHeader) && !base.IsSerializing && !base.IsDeserializing && !base.InDesignMode)
			{
				if(base.ParticipatesInTransaction)
				{
					if(!_reportCategoryCollectionViaReportHeader.ParticipatesInTransaction)
					{
						base.Transaction.Add(_reportCategoryCollectionViaReportHeader);
					}
				}
				IPredicateExpression filter = new PredicateExpression();
				filter.Add(new FieldCompareValuePredicate(UserFields.UserId, ComparisonOperator.Equal, this.UserId, "UserEntity__"));
				_reportCategoryCollectionViaReportHeader.SuppressClearInGetMulti=!forceFetch;
				if(entityFactoryToUse!=null)
				{
					_reportCategoryCollectionViaReportHeader.EntityFactoryToUse = entityFactoryToUse;
				}
				_reportCategoryCollectionViaReportHeader.GetMulti(filter, GetRelationsForField("ReportCategoryCollectionViaReportHeader"));
				_reportCategoryCollectionViaReportHeader.SuppressClearInGetMulti=false;
				_alreadyFetchedReportCategoryCollectionViaReportHeader = true;
			}
			return _reportCategoryCollectionViaReportHeader;
		}

		/// <summary> Sets the collection parameters for the collection for 'ReportCategoryCollectionViaReportHeader'. These settings will be taken into account
		/// when the property ReportCategoryCollectionViaReportHeader is requested or GetMultiReportCategoryCollectionViaReportHeader is called.</summary>
		/// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return. When set to 0, this parameter is ignored</param>
		/// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified (null), no sorting is applied.</param>
		public virtual void SetCollectionParametersReportCategoryCollectionViaReportHeader(long maxNumberOfItemsToReturn, ISortExpression sortClauses)
		{
			_reportCategoryCollectionViaReportHeader.SortClauses=sortClauses;
			_reportCategoryCollectionViaReportHeader.MaxNumberOfItemsToReturn=maxNumberOfItemsToReturn;
		}

		/// <summary> Retrieves all related entities of type 'ReportCategoryEntity' using a relation of type 'm:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <returns>Filled collection with all related entities of type 'ReportCategoryEntity'</returns>
		public CARMSData.CollectionClasses.ReportCategoryCollection GetMultiReportCategoryCollectionViaUserPermission(bool forceFetch)
		{
			return GetMultiReportCategoryCollectionViaUserPermission(forceFetch, _reportCategoryCollectionViaUserPermission.EntityFactoryToUse);
		}

		/// <summary> Retrieves all related entities of type 'ReportCategoryEntity' using a relation of type 'm:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="entityFactoryToUse">The entity factory to use for the GetMultiManyToMany() routine.</param>
		/// <returns>Filled collection with all related entities of the type constructed by the passed in entity factory</returns>
		public CARMSData.CollectionClasses.ReportCategoryCollection GetMultiReportCategoryCollectionViaUserPermission(bool forceFetch, IEntityFactory entityFactoryToUse)
		{
 			if( ( !_alreadyFetchedReportCategoryCollectionViaUserPermission || forceFetch || _alwaysFetchReportCategoryCollectionViaUserPermission) && !base.IsSerializing && !base.IsDeserializing && !base.InDesignMode)
			{
				if(base.ParticipatesInTransaction)
				{
					if(!_reportCategoryCollectionViaUserPermission.ParticipatesInTransaction)
					{
						base.Transaction.Add(_reportCategoryCollectionViaUserPermission);
					}
				}
				IPredicateExpression filter = new PredicateExpression();
				filter.Add(new FieldCompareValuePredicate(UserFields.UserId, ComparisonOperator.Equal, this.UserId, "UserEntity__"));
				_reportCategoryCollectionViaUserPermission.SuppressClearInGetMulti=!forceFetch;
				if(entityFactoryToUse!=null)
				{
					_reportCategoryCollectionViaUserPermission.EntityFactoryToUse = entityFactoryToUse;
				}
				_reportCategoryCollectionViaUserPermission.GetMulti(filter, GetRelationsForField("ReportCategoryCollectionViaUserPermission"));
				_reportCategoryCollectionViaUserPermission.SuppressClearInGetMulti=false;
				_alreadyFetchedReportCategoryCollectionViaUserPermission = true;
			}
			return _reportCategoryCollectionViaUserPermission;
		}

		/// <summary> Sets the collection parameters for the collection for 'ReportCategoryCollectionViaUserPermission'. These settings will be taken into account
		/// when the property ReportCategoryCollectionViaUserPermission is requested or GetMultiReportCategoryCollectionViaUserPermission is called.</summary>
		/// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return. When set to 0, this parameter is ignored</param>
		/// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified (null), no sorting is applied.</param>
		public virtual void SetCollectionParametersReportCategoryCollectionViaUserPermission(long maxNumberOfItemsToReturn, ISortExpression sortClauses)
		{
			_reportCategoryCollectionViaUserPermission.SortClauses=sortClauses;
			_reportCategoryCollectionViaUserPermission.MaxNumberOfItemsToReturn=maxNumberOfItemsToReturn;
		}

		/// <summary> Retrieves all related entities of type 'ReportFlowEntity' using a relation of type 'm:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <returns>Filled collection with all related entities of type 'ReportFlowEntity'</returns>
		public CARMSData.CollectionClasses.ReportFlowCollection GetMultiReportFlowCollectionViaReportHeader(bool forceFetch)
		{
			return GetMultiReportFlowCollectionViaReportHeader(forceFetch, _reportFlowCollectionViaReportHeader.EntityFactoryToUse);
		}

		/// <summary> Retrieves all related entities of type 'ReportFlowEntity' using a relation of type 'm:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="entityFactoryToUse">The entity factory to use for the GetMultiManyToMany() routine.</param>
		/// <returns>Filled collection with all related entities of the type constructed by the passed in entity factory</returns>
		public CARMSData.CollectionClasses.ReportFlowCollection GetMultiReportFlowCollectionViaReportHeader(bool forceFetch, IEntityFactory entityFactoryToUse)
		{
 			if( ( !_alreadyFetchedReportFlowCollectionViaReportHeader || forceFetch || _alwaysFetchReportFlowCollectionViaReportHeader) && !base.IsSerializing && !base.IsDeserializing && !base.InDesignMode)
			{
				if(base.ParticipatesInTransaction)
				{
					if(!_reportFlowCollectionViaReportHeader.ParticipatesInTransaction)
					{
						base.Transaction.Add(_reportFlowCollectionViaReportHeader);
					}
				}
				IPredicateExpression filter = new PredicateExpression();
				filter.Add(new FieldCompareValuePredicate(UserFields.UserId, ComparisonOperator.Equal, this.UserId, "UserEntity__"));
				_reportFlowCollectionViaReportHeader.SuppressClearInGetMulti=!forceFetch;
				if(entityFactoryToUse!=null)
				{
					_reportFlowCollectionViaReportHeader.EntityFactoryToUse = entityFactoryToUse;
				}
				_reportFlowCollectionViaReportHeader.GetMulti(filter, GetRelationsForField("ReportFlowCollectionViaReportHeader"));
				_reportFlowCollectionViaReportHeader.SuppressClearInGetMulti=false;
				_alreadyFetchedReportFlowCollectionViaReportHeader = true;
			}
			return _reportFlowCollectionViaReportHeader;
		}

		/// <summary> Sets the collection parameters for the collection for 'ReportFlowCollectionViaReportHeader'. These settings will be taken into account
		/// when the property ReportFlowCollectionViaReportHeader is requested or GetMultiReportFlowCollectionViaReportHeader is called.</summary>
		/// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return. When set to 0, this parameter is ignored</param>
		/// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified (null), no sorting is applied.</param>
		public virtual void SetCollectionParametersReportFlowCollectionViaReportHeader(long maxNumberOfItemsToReturn, ISortExpression sortClauses)
		{
			_reportFlowCollectionViaReportHeader.SortClauses=sortClauses;
			_reportFlowCollectionViaReportHeader.MaxNumberOfItemsToReturn=maxNumberOfItemsToReturn;
		}

		/// <summary> Retrieves all related entities of type 'ReportHeaderEntity' using a relation of type 'm:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <returns>Filled collection with all related entities of type 'ReportHeaderEntity'</returns>
		public CARMSData.CollectionClasses.ReportHeaderCollection GetMultiReportHeaderCollectionViaMessage(bool forceFetch)
		{
			return GetMultiReportHeaderCollectionViaMessage(forceFetch, _reportHeaderCollectionViaMessage.EntityFactoryToUse);
		}

		/// <summary> Retrieves all related entities of type 'ReportHeaderEntity' using a relation of type 'm:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="entityFactoryToUse">The entity factory to use for the GetMultiManyToMany() routine.</param>
		/// <returns>Filled collection with all related entities of the type constructed by the passed in entity factory</returns>
		public CARMSData.CollectionClasses.ReportHeaderCollection GetMultiReportHeaderCollectionViaMessage(bool forceFetch, IEntityFactory entityFactoryToUse)
		{
 			if( ( !_alreadyFetchedReportHeaderCollectionViaMessage || forceFetch || _alwaysFetchReportHeaderCollectionViaMessage) && !base.IsSerializing && !base.IsDeserializing && !base.InDesignMode)
			{
				if(base.ParticipatesInTransaction)
				{
					if(!_reportHeaderCollectionViaMessage.ParticipatesInTransaction)
					{
						base.Transaction.Add(_reportHeaderCollectionViaMessage);
					}
				}
				IPredicateExpression filter = new PredicateExpression();
				filter.Add(new FieldCompareValuePredicate(UserFields.UserId, ComparisonOperator.Equal, this.UserId, "UserEntity__"));
				_reportHeaderCollectionViaMessage.SuppressClearInGetMulti=!forceFetch;
				if(entityFactoryToUse!=null)
				{
					_reportHeaderCollectionViaMessage.EntityFactoryToUse = entityFactoryToUse;
				}
				_reportHeaderCollectionViaMessage.GetMulti(filter, GetRelationsForField("ReportHeaderCollectionViaMessage"));
				_reportHeaderCollectionViaMessage.SuppressClearInGetMulti=false;
				_alreadyFetchedReportHeaderCollectionViaMessage = true;
			}
			return _reportHeaderCollectionViaMessage;
		}

		/// <summary> Sets the collection parameters for the collection for 'ReportHeaderCollectionViaMessage'. These settings will be taken into account
		/// when the property ReportHeaderCollectionViaMessage is requested or GetMultiReportHeaderCollectionViaMessage is called.</summary>
		/// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return. When set to 0, this parameter is ignored</param>
		/// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified (null), no sorting is applied.</param>
		public virtual void SetCollectionParametersReportHeaderCollectionViaMessage(long maxNumberOfItemsToReturn, ISortExpression sortClauses)
		{
			_reportHeaderCollectionViaMessage.SortClauses=sortClauses;
			_reportHeaderCollectionViaMessage.MaxNumberOfItemsToReturn=maxNumberOfItemsToReturn;
		}

		/// <summary> Retrieves all related entities of type 'RoleEntity' using a relation of type 'm:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <returns>Filled collection with all related entities of type 'RoleEntity'</returns>
		public CARMSData.CollectionClasses.RoleCollection GetMultiRoleCollectionViaUserRole(bool forceFetch)
		{
			return GetMultiRoleCollectionViaUserRole(forceFetch, _roleCollectionViaUserRole.EntityFactoryToUse);
		}

		/// <summary> Retrieves all related entities of type 'RoleEntity' using a relation of type 'm:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="entityFactoryToUse">The entity factory to use for the GetMultiManyToMany() routine.</param>
		/// <returns>Filled collection with all related entities of the type constructed by the passed in entity factory</returns>
		public CARMSData.CollectionClasses.RoleCollection GetMultiRoleCollectionViaUserRole(bool forceFetch, IEntityFactory entityFactoryToUse)
		{
 			if( ( !_alreadyFetchedRoleCollectionViaUserRole || forceFetch || _alwaysFetchRoleCollectionViaUserRole) && !base.IsSerializing && !base.IsDeserializing && !base.InDesignMode)
			{
				if(base.ParticipatesInTransaction)
				{
					if(!_roleCollectionViaUserRole.ParticipatesInTransaction)
					{
						base.Transaction.Add(_roleCollectionViaUserRole);
					}
				}
				IPredicateExpression filter = new PredicateExpression();
				filter.Add(new FieldCompareValuePredicate(UserFields.UserId, ComparisonOperator.Equal, this.UserId, "UserEntity__"));
				_roleCollectionViaUserRole.SuppressClearInGetMulti=!forceFetch;
				if(entityFactoryToUse!=null)
				{
					_roleCollectionViaUserRole.EntityFactoryToUse = entityFactoryToUse;
				}
				_roleCollectionViaUserRole.GetMulti(filter, GetRelationsForField("RoleCollectionViaUserRole"));
				_roleCollectionViaUserRole.SuppressClearInGetMulti=false;
				_alreadyFetchedRoleCollectionViaUserRole = true;
			}
			return _roleCollectionViaUserRole;
		}

		/// <summary> Sets the collection parameters for the collection for 'RoleCollectionViaUserRole'. These settings will be taken into account
		/// when the property RoleCollectionViaUserRole is requested or GetMultiRoleCollectionViaUserRole is called.</summary>
		/// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return. When set to 0, this parameter is ignored</param>
		/// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified (null), no sorting is applied.</param>
		public virtual void SetCollectionParametersRoleCollectionViaUserRole(long maxNumberOfItemsToReturn, ISortExpression sortClauses)
		{
			_roleCollectionViaUserRole.SortClauses=sortClauses;
			_roleCollectionViaUserRole.MaxNumberOfItemsToReturn=maxNumberOfItemsToReturn;
		}

		/// <summary> Retrieves all related entities of type 'TemplateEntity' using a relation of type 'm:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <returns>Filled collection with all related entities of type 'TemplateEntity'</returns>
		public CARMSData.CollectionClasses.TemplateCollection GetMultiTemplateCollectionViaMessage(bool forceFetch)
		{
			return GetMultiTemplateCollectionViaMessage(forceFetch, _templateCollectionViaMessage.EntityFactoryToUse);
		}

		/// <summary> Retrieves all related entities of type 'TemplateEntity' using a relation of type 'm:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="entityFactoryToUse">The entity factory to use for the GetMultiManyToMany() routine.</param>
		/// <returns>Filled collection with all related entities of the type constructed by the passed in entity factory</returns>
		public CARMSData.CollectionClasses.TemplateCollection GetMultiTemplateCollectionViaMessage(bool forceFetch, IEntityFactory entityFactoryToUse)
		{
 			if( ( !_alreadyFetchedTemplateCollectionViaMessage || forceFetch || _alwaysFetchTemplateCollectionViaMessage) && !base.IsSerializing && !base.IsDeserializing && !base.InDesignMode)
			{
				if(base.ParticipatesInTransaction)
				{
					if(!_templateCollectionViaMessage.ParticipatesInTransaction)
					{
						base.Transaction.Add(_templateCollectionViaMessage);
					}
				}
				IPredicateExpression filter = new PredicateExpression();
				filter.Add(new FieldCompareValuePredicate(UserFields.UserId, ComparisonOperator.Equal, this.UserId, "UserEntity__"));
				_templateCollectionViaMessage.SuppressClearInGetMulti=!forceFetch;
				if(entityFactoryToUse!=null)
				{
					_templateCollectionViaMessage.EntityFactoryToUse = entityFactoryToUse;
				}
				_templateCollectionViaMessage.GetMulti(filter, GetRelationsForField("TemplateCollectionViaMessage"));
				_templateCollectionViaMessage.SuppressClearInGetMulti=false;
				_alreadyFetchedTemplateCollectionViaMessage = true;
			}
			return _templateCollectionViaMessage;
		}

		/// <summary> Sets the collection parameters for the collection for 'TemplateCollectionViaMessage'. These settings will be taken into account
		/// when the property TemplateCollectionViaMessage is requested or GetMultiTemplateCollectionViaMessage is called.</summary>
		/// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return. When set to 0, this parameter is ignored</param>
		/// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified (null), no sorting is applied.</param>
		public virtual void SetCollectionParametersTemplateCollectionViaMessage(long maxNumberOfItemsToReturn, ISortExpression sortClauses)
		{
			_templateCollectionViaMessage.SortClauses=sortClauses;
			_templateCollectionViaMessage.MaxNumberOfItemsToReturn=maxNumberOfItemsToReturn;
		}



		/// <summary> Performs the insert action of a new Entity to the persistent storage.</summary>
		/// <returns>true if succeeded, false otherwise</returns>
		protected override bool InsertEntity()
		{
			UserDAO dao = (UserDAO)CreateDAOInstance();
			return dao.AddNew(base.Fields, base.Transaction);
		}
		
		/// <summary> Adds the internals to the active context. </summary>
		protected override void AddInternalsToContext()
		{
			_message.ActiveContext = base.ActiveContext;
			_reportHeader.ActiveContext = base.ActiveContext;
			_userAction.ActiveContext = base.ActiveContext;
			_userPermission.ActiveContext = base.ActiveContext;
			_userRole.ActiveContext = base.ActiveContext;
			_actionCollectionViaUserAction.ActiveContext = base.ActiveContext;
			_reportCategoryCollectionViaReportHeader.ActiveContext = base.ActiveContext;
			_reportCategoryCollectionViaUserPermission.ActiveContext = base.ActiveContext;
			_reportFlowCollectionViaReportHeader.ActiveContext = base.ActiveContext;
			_reportHeaderCollectionViaMessage.ActiveContext = base.ActiveContext;
			_roleCollectionViaUserRole.ActiveContext = base.ActiveContext;
			_templateCollectionViaMessage.ActiveContext = base.ActiveContext;



		}


		/// <summary> Performs the update action of an existing Entity to the persistent storage.</summary>
		/// <returns>true if succeeded, false otherwise</returns>
		protected override bool UpdateEntity()
		{
			UserDAO dao = (UserDAO)CreateDAOInstance();
			return dao.UpdateExisting(base.Fields, base.Transaction);
		}
		
		/// <summary> Performs the update action of an existing Entity to the persistent storage.</summary>
		/// <param name="updateRestriction">Predicate expression, meant for concurrency checks in an Update query</param>
		/// <returns>true if succeeded, false otherwise</returns>
		protected override bool UpdateEntity(IPredicate updateRestriction)
		{
			UserDAO dao = (UserDAO)CreateDAOInstance();
			return dao.UpdateExisting(base.Fields, base.Transaction, updateRestriction);
		}
	
		/// <summary> Initializes the class with empty data, as if it is a new Entity.</summary>
		/// <param name="validatorToUse">Validator to use.</param>
		protected virtual void InitClassEmpty(IValidator validatorToUse)
		{
			OnInitializing();
			base.Fields = CreateFields();
			base.IsNew=true;
			base.Validator = validatorToUse;

			InitClassMembers();
			
			// __LLBLGENPRO_USER_CODE_REGION_START InitClassEmpty
			// __LLBLGENPRO_USER_CODE_REGION_END

			OnInitialized();
		}
		
		/// <summary>Creates entity fields object for this entity. Used in constructor to setup this entity in a polymorphic scenario.</summary>
		protected virtual IEntityFields CreateFields()
		{
			return EntityFieldsFactory.CreateEntityFieldsObject(CARMSData.EntityType.UserEntity);
		}
		
		/// <summary>Creates a new transaction object</summary>
		/// <param name="levelOfIsolation">The level of isolation.</param>
		/// <param name="name">The name.</param>
		protected override ITransaction CreateTransaction( IsolationLevel levelOfIsolation, string name )
		{
			return new Transaction(levelOfIsolation, name);
		}

		/// <summary>
		/// Creates the ITypeDefaultValue instance used to provide default values for value types which aren't of type nullable(of T)
		/// </summary>
		/// <returns></returns>
		protected override ITypeDefaultValue CreateTypeDefaultValueProvider()
		{
			return new TypeDefaultValue();
		}

		/// <summary>
		/// Gets all related data objects, stored by name. The name is the field name mapped onto the relation for that particular data element. 
		/// </summary>
		/// <returns>Dictionary with per name the related referenced data element, which can be an entity collection or an entity or null</returns>
		public override Dictionary<string, object> GetRelatedData()
		{
			Dictionary<string, object> toReturn = new Dictionary<string, object>();

			toReturn.Add("Message", _message);
			toReturn.Add("ReportHeader", _reportHeader);
			toReturn.Add("UserAction", _userAction);
			toReturn.Add("UserPermission", _userPermission);
			toReturn.Add("UserRole", _userRole);
			toReturn.Add("ActionCollectionViaUserAction", _actionCollectionViaUserAction);
			toReturn.Add("ReportCategoryCollectionViaReportHeader", _reportCategoryCollectionViaReportHeader);
			toReturn.Add("ReportCategoryCollectionViaUserPermission", _reportCategoryCollectionViaUserPermission);
			toReturn.Add("ReportFlowCollectionViaReportHeader", _reportFlowCollectionViaReportHeader);
			toReturn.Add("ReportHeaderCollectionViaMessage", _reportHeaderCollectionViaMessage);
			toReturn.Add("RoleCollectionViaUserRole", _roleCollectionViaUserRole);
			toReturn.Add("TemplateCollectionViaMessage", _templateCollectionViaMessage);

			return toReturn;
		}
		

		/// <summary> Initializes the the entity and fetches the data related to the entity in this entity.</summary>
		/// <param name="userId">PK value for User which data should be fetched into this User object</param>
		/// <param name="validator">The validator object for this UserEntity</param>
		/// <param name="prefetchPathToUse">the PrefetchPath which defines the graph of objects to fetch as well</param>
		protected virtual void InitClassFetch(System.Int32 userId, IValidator validator, IPrefetchPath prefetchPathToUse)
		{
			OnInitializing();
			base.Validator = validator;
			InitClassMembers();
			base.Fields = CreateFields();
			bool wasSuccesful = Fetch(userId, prefetchPathToUse, null, null);
			base.IsNew = !wasSuccesful;

			
			// __LLBLGENPRO_USER_CODE_REGION_START InitClassFetch
			// __LLBLGENPRO_USER_CODE_REGION_END

			OnInitialized();
		}

		/// <summary> Initializes the class members</summary>
		private void InitClassMembers()
		{
			_message = new CARMSData.CollectionClasses.MessageCollection(new MessageEntityFactory());
			_message.SetContainingEntityInfo(this, "User");
			_alwaysFetchMessage = false;
			_alreadyFetchedMessage = false;
			_reportHeader = new CARMSData.CollectionClasses.ReportHeaderCollection(new ReportHeaderEntityFactory());
			_reportHeader.SetContainingEntityInfo(this, "User");
			_alwaysFetchReportHeader = false;
			_alreadyFetchedReportHeader = false;
			_userAction = new CARMSData.CollectionClasses.UserActionCollection(new UserActionEntityFactory());
			_userAction.SetContainingEntityInfo(this, "User");
			_alwaysFetchUserAction = false;
			_alreadyFetchedUserAction = false;
			_userPermission = new CARMSData.CollectionClasses.UserPermissionCollection(new UserPermissionEntityFactory());
			_userPermission.SetContainingEntityInfo(this, "User");
			_alwaysFetchUserPermission = false;
			_alreadyFetchedUserPermission = false;
			_userRole = new CARMSData.CollectionClasses.UserRoleCollection(new UserRoleEntityFactory());
			_userRole.SetContainingEntityInfo(this, "User");
			_alwaysFetchUserRole = false;
			_alreadyFetchedUserRole = false;
			_actionCollectionViaUserAction = new CARMSData.CollectionClasses.ActionCollection(new ActionEntityFactory());
			_alwaysFetchActionCollectionViaUserAction = false;
			_alreadyFetchedActionCollectionViaUserAction = false;
			_reportCategoryCollectionViaReportHeader = new CARMSData.CollectionClasses.ReportCategoryCollection(new ReportCategoryEntityFactory());
			_alwaysFetchReportCategoryCollectionViaReportHeader = false;
			_alreadyFetchedReportCategoryCollectionViaReportHeader = false;
			_reportCategoryCollectionViaUserPermission = new CARMSData.CollectionClasses.ReportCategoryCollection(new ReportCategoryEntityFactory());
			_alwaysFetchReportCategoryCollectionViaUserPermission = false;
			_alreadyFetchedReportCategoryCollectionViaUserPermission = false;
			_reportFlowCollectionViaReportHeader = new CARMSData.CollectionClasses.ReportFlowCollection(new ReportFlowEntityFactory());
			_alwaysFetchReportFlowCollectionViaReportHeader = false;
			_alreadyFetchedReportFlowCollectionViaReportHeader = false;
			_reportHeaderCollectionViaMessage = new CARMSData.CollectionClasses.ReportHeaderCollection(new ReportHeaderEntityFactory());
			_alwaysFetchReportHeaderCollectionViaMessage = false;
			_alreadyFetchedReportHeaderCollectionViaMessage = false;
			_roleCollectionViaUserRole = new CARMSData.CollectionClasses.RoleCollection(new RoleEntityFactory());
			_alwaysFetchRoleCollectionViaUserRole = false;
			_alreadyFetchedRoleCollectionViaUserRole = false;
			_templateCollectionViaMessage = new CARMSData.CollectionClasses.TemplateCollection(new TemplateEntityFactory());
			_alwaysFetchTemplateCollectionViaMessage = false;
			_alreadyFetchedTemplateCollectionViaMessage = false;



			PerformDependencyInjection();
			
			// __LLBLGENPRO_USER_CODE_REGION_START InitClassMembers
			// __LLBLGENPRO_USER_CODE_REGION_END
			OnInitClassMembersComplete();
		}

		#region Custom Property Hashtable Setup
		/// <summary> Initializes the hashtables for the entity type and entity field custom properties. </summary>
		private static void SetupCustomPropertyHashtables()
		{
			_customProperties = new Dictionary<string, string>();
			_fieldsCustomProperties = new Dictionary<string, Dictionary<string, string>>();

			Dictionary<string, string> fieldHashtable = null;
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("UserId", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("UserCode", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("DepartmentId", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("ZhiWu", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("BanZhi", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("FullName", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("Sex", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("LoginName", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("Password", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("Address", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("Tel", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("Mobile", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("Email", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("CreateDate", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("IsActived", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("BloodType", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("Marriage", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("Idcard", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("BirthDay", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("Degree", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("Address1", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("Address2", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("UrgentPerson", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("UrgentTel", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("Bank", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("BankIdCard", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("FamillyNumber", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("SalaryLevel", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("ZhiWuAllowance", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("JianBaoAllowance", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("LaoBaoAllowance", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("HuoShiAllowance", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("JiShuAllowance", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("QiTaAllowance", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("JiaoTongAllowance", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("TongXunAllowance", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("QuanQinAllowance", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("LaoBaoSelfResponse", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("JianBaoSelfResponse", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("HuoShiSelfResponse", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("FamilySelfResponse", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("TouBaoDate", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("TuiBaoDate", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("DaoZhiDate", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("LiZhiDate", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("JiFen", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("Status", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("Regex", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("Remark", fieldHashtable);
		}
		#endregion




		/// <summary> Fetches the entity from the persistent storage. Fetch simply reads the entity into an EntityFields object. </summary>
		/// <param name="userId">PK value for User which data should be fetched into this User object</param>
		/// <param name="prefetchPathToUse">the PrefetchPath which defines the graph of objects to fetch as well</param>
		/// <param name="contextToUse">The context to add the entity to if the fetch was succesful. </param>
		/// <param name="excludedIncludedFields">The list of IEntityField objects which have to be excluded or included for the fetch. 
		/// If null or empty, all fields are fetched (default). If an instance of ExcludeIncludeFieldsList is passed in and its ExcludeContainedFields property
		/// is set to false, the fields contained in excludedIncludedFields are kept in the query, the rest of the fields in the query are excluded.</param>
		/// <returns>True if succeeded, false otherwise.</returns>
		private bool Fetch(System.Int32 userId, IPrefetchPath prefetchPathToUse, Context contextToUse, ExcludeIncludeFieldsList excludedIncludedFields)
		{
			try
			{
				OnFetch();
				IDao dao = this.CreateDAOInstance();
				base.Fields[(int)UserFieldIndex.UserId].ForcedCurrentValueWrite(userId);
				dao.FetchExisting(this, base.Transaction, prefetchPathToUse, contextToUse, excludedIncludedFields);
				return (base.Fields.State == EntityState.Fetched);
			}
			finally
			{
				OnFetchComplete();
			}
		}


		/// <summary> Creates the DAO instance for this type</summary>
		/// <returns></returns>
		protected override IDao CreateDAOInstance()
		{
			return DAOFactory.CreateUserDAO();
		}
		
		/// <summary> Creates the entity factory for this type.</summary>
		/// <returns></returns>
		protected override IEntityFactory CreateEntityFactory()
		{
			return new UserEntityFactory();
		}

		#region Class Property Declarations
		/// <summary> The relations object holding all relations of this entity with other entity classes.</summary>
		public  static UserRelations Relations
		{
			get	{ return new UserRelations(); }
		}
		
		/// <summary> The custom properties for this entity type.</summary>
		/// <remarks>The data returned from this property should be considered read-only: it is not thread safe to alter this data at runtime.</remarks>
		public  static Dictionary<string, string> CustomProperties
		{
			get { return _customProperties;}
		}


		/// <summary> Creates a new PrefetchPathElement object which contains all the information to prefetch the related entities of type 'Message' 
		/// for this entity. Add the object returned by this property to an existing PrefetchPath instance.</summary>
		/// <returns>Ready to use IPrefetchPathElement implementation.</returns>
		public static IPrefetchPathElement PrefetchPathMessage
		{
			get
			{
				return new PrefetchPathElement(new CARMSData.CollectionClasses.MessageCollection(),
					(IEntityRelation)GetRelationsForField("Message")[0], (int)CARMSData.EntityType.UserEntity, (int)CARMSData.EntityType.MessageEntity, 0, null, null, null, "Message", SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany);
			}
		}

		/// <summary> Creates a new PrefetchPathElement object which contains all the information to prefetch the related entities of type 'ReportHeader' 
		/// for this entity. Add the object returned by this property to an existing PrefetchPath instance.</summary>
		/// <returns>Ready to use IPrefetchPathElement implementation.</returns>
		public static IPrefetchPathElement PrefetchPathReportHeader
		{
			get
			{
				return new PrefetchPathElement(new CARMSData.CollectionClasses.ReportHeaderCollection(),
					(IEntityRelation)GetRelationsForField("ReportHeader")[0], (int)CARMSData.EntityType.UserEntity, (int)CARMSData.EntityType.ReportHeaderEntity, 0, null, null, null, "ReportHeader", SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany);
			}
		}

		/// <summary> Creates a new PrefetchPathElement object which contains all the information to prefetch the related entities of type 'UserAction' 
		/// for this entity. Add the object returned by this property to an existing PrefetchPath instance.</summary>
		/// <returns>Ready to use IPrefetchPathElement implementation.</returns>
		public static IPrefetchPathElement PrefetchPathUserAction
		{
			get
			{
				return new PrefetchPathElement(new CARMSData.CollectionClasses.UserActionCollection(),
					(IEntityRelation)GetRelationsForField("UserAction")[0], (int)CARMSData.EntityType.UserEntity, (int)CARMSData.EntityType.UserActionEntity, 0, null, null, null, "UserAction", SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany);
			}
		}

		/// <summary> Creates a new PrefetchPathElement object which contains all the information to prefetch the related entities of type 'UserPermission' 
		/// for this entity. Add the object returned by this property to an existing PrefetchPath instance.</summary>
		/// <returns>Ready to use IPrefetchPathElement implementation.</returns>
		public static IPrefetchPathElement PrefetchPathUserPermission
		{
			get
			{
				return new PrefetchPathElement(new CARMSData.CollectionClasses.UserPermissionCollection(),
					(IEntityRelation)GetRelationsForField("UserPermission")[0], (int)CARMSData.EntityType.UserEntity, (int)CARMSData.EntityType.UserPermissionEntity, 0, null, null, null, "UserPermission", SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany);
			}
		}

		/// <summary> Creates a new PrefetchPathElement object which contains all the information to prefetch the related entities of type 'UserRole' 
		/// for this entity. Add the object returned by this property to an existing PrefetchPath instance.</summary>
		/// <returns>Ready to use IPrefetchPathElement implementation.</returns>
		public static IPrefetchPathElement PrefetchPathUserRole
		{
			get
			{
				return new PrefetchPathElement(new CARMSData.CollectionClasses.UserRoleCollection(),
					(IEntityRelation)GetRelationsForField("UserRole")[0], (int)CARMSData.EntityType.UserEntity, (int)CARMSData.EntityType.UserRoleEntity, 0, null, null, null, "UserRole", SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany);
			}
		}

		/// <summary> Creates a new PrefetchPathElement object which contains all the information to prefetch the related entities of type 'Action' 
		/// for this entity. Add the object returned by this property to an existing PrefetchPath instance.</summary>
		/// <returns>Ready to use IPrefetchPathElement implementation.</returns>
		public static IPrefetchPathElement PrefetchPathActionCollectionViaUserAction
		{
			get
			{
				IEntityRelation intermediateRelation = UserEntity.Relations.UserActionEntityUsingUserId;
				intermediateRelation.SetAliases(string.Empty, "UserAction_");
				return new PrefetchPathElement(new CARMSData.CollectionClasses.ActionCollection(), intermediateRelation,
					(int)CARMSData.EntityType.UserEntity, (int)CARMSData.EntityType.ActionEntity, 0, null, null, GetRelationsForField("ActionCollectionViaUserAction"), "ActionCollectionViaUserAction", SD.LLBLGen.Pro.ORMSupportClasses.RelationType.ManyToMany);
			}
		}

		/// <summary> Creates a new PrefetchPathElement object which contains all the information to prefetch the related entities of type 'ReportCategory' 
		/// for this entity. Add the object returned by this property to an existing PrefetchPath instance.</summary>
		/// <returns>Ready to use IPrefetchPathElement implementation.</returns>
		public static IPrefetchPathElement PrefetchPathReportCategoryCollectionViaReportHeader
		{
			get
			{
				IEntityRelation intermediateRelation = UserEntity.Relations.ReportHeaderEntityUsingApplyUserId;
				intermediateRelation.SetAliases(string.Empty, "ReportHeader_");
				return new PrefetchPathElement(new CARMSData.CollectionClasses.ReportCategoryCollection(), intermediateRelation,
					(int)CARMSData.EntityType.UserEntity, (int)CARMSData.EntityType.ReportCategoryEntity, 0, null, null, GetRelationsForField("ReportCategoryCollectionViaReportHeader"), "ReportCategoryCollectionViaReportHeader", SD.LLBLGen.Pro.ORMSupportClasses.RelationType.ManyToMany);
			}
		}

		/// <summary> Creates a new PrefetchPathElement object which contains all the information to prefetch the related entities of type 'ReportCategory' 
		/// for this entity. Add the object returned by this property to an existing PrefetchPath instance.</summary>
		/// <returns>Ready to use IPrefetchPathElement implementation.</returns>
		public static IPrefetchPathElement PrefetchPathReportCategoryCollectionViaUserPermission
		{
			get
			{
				IEntityRelation intermediateRelation = UserEntity.Relations.UserPermissionEntityUsingUserId;
				intermediateRelation.SetAliases(string.Empty, "UserPermission_");
				return new PrefetchPathElement(new CARMSData.CollectionClasses.ReportCategoryCollection(), intermediateRelation,
					(int)CARMSData.EntityType.UserEntity, (int)CARMSData.EntityType.ReportCategoryEntity, 0, null, null, GetRelationsForField("ReportCategoryCollectionViaUserPermission"), "ReportCategoryCollectionViaUserPermission", SD.LLBLGen.Pro.ORMSupportClasses.RelationType.ManyToMany);
			}
		}

		/// <summary> Creates a new PrefetchPathElement object which contains all the information to prefetch the related entities of type 'ReportFlow' 
		/// for this entity. Add the object returned by this property to an existing PrefetchPath instance.</summary>
		/// <returns>Ready to use IPrefetchPathElement implementation.</returns>
		public static IPrefetchPathElement PrefetchPathReportFlowCollectionViaReportHeader
		{
			get
			{
				IEntityRelation intermediateRelation = UserEntity.Relations.ReportHeaderEntityUsingApplyUserId;
				intermediateRelation.SetAliases(string.Empty, "ReportHeader_");
				return new PrefetchPathElement(new CARMSData.CollectionClasses.ReportFlowCollection(), intermediateRelation,
					(int)CARMSData.EntityType.UserEntity, (int)CARMSData.EntityType.ReportFlowEntity, 0, null, null, GetRelationsForField("ReportFlowCollectionViaReportHeader"), "ReportFlowCollectionViaReportHeader", SD.LLBLGen.Pro.ORMSupportClasses.RelationType.ManyToMany);
			}
		}

		/// <summary> Creates a new PrefetchPathElement object which contains all the information to prefetch the related entities of type 'ReportHeader' 
		/// for this entity. Add the object returned by this property to an existing PrefetchPath instance.</summary>
		/// <returns>Ready to use IPrefetchPathElement implementation.</returns>
		public static IPrefetchPathElement PrefetchPathReportHeaderCollectionViaMessage
		{
			get
			{
				IEntityRelation intermediateRelation = UserEntity.Relations.MessageEntityUsingTargetUserId;
				intermediateRelation.SetAliases(string.Empty, "Message_");
				return new PrefetchPathElement(new CARMSData.CollectionClasses.ReportHeaderCollection(), intermediateRelation,
					(int)CARMSData.EntityType.UserEntity, (int)CARMSData.EntityType.ReportHeaderEntity, 0, null, null, GetRelationsForField("ReportHeaderCollectionViaMessage"), "ReportHeaderCollectionViaMessage", SD.LLBLGen.Pro.ORMSupportClasses.RelationType.ManyToMany);
			}
		}

		/// <summary> Creates a new PrefetchPathElement object which contains all the information to prefetch the related entities of type 'Role' 
		/// for this entity. Add the object returned by this property to an existing PrefetchPath instance.</summary>
		/// <returns>Ready to use IPrefetchPathElement implementation.</returns>
		public static IPrefetchPathElement PrefetchPathRoleCollectionViaUserRole
		{
			get
			{
				IEntityRelation intermediateRelation = UserEntity.Relations.UserRoleEntityUsingUserId;
				intermediateRelation.SetAliases(string.Empty, "UserRole_");
				return new PrefetchPathElement(new CARMSData.CollectionClasses.RoleCollection(), intermediateRelation,
					(int)CARMSData.EntityType.UserEntity, (int)CARMSData.EntityType.RoleEntity, 0, null, null, GetRelationsForField("RoleCollectionViaUserRole"), "RoleCollectionViaUserRole", SD.LLBLGen.Pro.ORMSupportClasses.RelationType.ManyToMany);
			}
		}

		/// <summary> Creates a new PrefetchPathElement object which contains all the information to prefetch the related entities of type 'Template' 
		/// for this entity. Add the object returned by this property to an existing PrefetchPath instance.</summary>
		/// <returns>Ready to use IPrefetchPathElement implementation.</returns>
		public static IPrefetchPathElement PrefetchPathTemplateCollectionViaMessage
		{
			get
			{
				IEntityRelation intermediateRelation = UserEntity.Relations.MessageEntityUsingTargetUserId;
				intermediateRelation.SetAliases(string.Empty, "Message_");
				return new PrefetchPathElement(new CARMSData.CollectionClasses.TemplateCollection(), intermediateRelation,
					(int)CARMSData.EntityType.UserEntity, (int)CARMSData.EntityType.TemplateEntity, 0, null, null, GetRelationsForField("TemplateCollectionViaMessage"), "TemplateCollectionViaMessage", SD.LLBLGen.Pro.ORMSupportClasses.RelationType.ManyToMany);
			}
		}



		/// <summary>Returns the full name for this entity, which is important for the DAO to find back persistence info for this entity.</summary>
		[Browsable(false), XmlIgnore]
		public override string LLBLGenProEntityName
		{
			get { return "UserEntity";}
		}

		/// <summary> The custom properties for the type of this entity instance.</summary>
		/// <remarks>The data returned from this property should be considered read-only: it is not thread safe to alter this data at runtime.</remarks>
		[Browsable(false), XmlIgnore]
		public override Dictionary<string, string> CustomPropertiesOfType
		{
			get { return UserEntity.CustomProperties;}
		}

		/// <summary> The custom properties for the fields of this entity type. The returned Hashtable contains per fieldname a hashtable of name-value pairs. </summary>
		/// <remarks>The data returned from this property should be considered read-only: it is not thread safe to alter this data at runtime.</remarks>
		public  static Dictionary<string, Dictionary<string, string>> FieldsCustomProperties
		{
			get { return _fieldsCustomProperties;}
		}

		/// <summary> The custom properties for the fields of the type of this entity instance. The returned Hashtable contains per fieldname a hashtable of name-value pairs. </summary>
		/// <remarks>The data returned from this property should be considered read-only: it is not thread safe to alter this data at runtime.</remarks>
		[Browsable(false), XmlIgnore]
		public override Dictionary<string, Dictionary<string, string>> FieldsCustomPropertiesOfType
		{
			get { return UserEntity.FieldsCustomProperties;}
		}

		/// <summary> The UserId property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."UserID"<br/>
		/// Table field type characteristics (type, precision, scale, length): Int, 10, 0, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): false, true, true</remarks>
		public virtual System.Int32 UserId
		{
			get { return (System.Int32)GetValue((int)UserFieldIndex.UserId, true); }
			set	{ SetValue((int)UserFieldIndex.UserId, value, true); }
		}
		/// <summary> The UserCode property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."UserCode"<br/>
		/// Table field type characteristics (type, precision, scale, length): NVarChar, 0, 0, 50<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String UserCode
		{
			get { return (System.String)GetValue((int)UserFieldIndex.UserCode, true); }
			set	{ SetValue((int)UserFieldIndex.UserCode, value, true); }
		}
		/// <summary> The DepartmentId property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."DepartmentID"<br/>
		/// Table field type characteristics (type, precision, scale, length): Int, 10, 0, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual Nullable<System.Int32> DepartmentId
		{
			get { return (Nullable<System.Int32>)GetValue((int)UserFieldIndex.DepartmentId, false); }
			set	{ SetValue((int)UserFieldIndex.DepartmentId, value, true); }
		}
		/// <summary> The ZhiWu property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."ZhiWu"<br/>
		/// Table field type characteristics (type, precision, scale, length): Int, 10, 0, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual Nullable<System.Int32> ZhiWu
		{
			get { return (Nullable<System.Int32>)GetValue((int)UserFieldIndex.ZhiWu, false); }
			set	{ SetValue((int)UserFieldIndex.ZhiWu, value, true); }
		}
		/// <summary> The BanZhi property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."BanZhi"<br/>
		/// Table field type characteristics (type, precision, scale, length): Int, 10, 0, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual Nullable<System.Int32> BanZhi
		{
			get { return (Nullable<System.Int32>)GetValue((int)UserFieldIndex.BanZhi, false); }
			set	{ SetValue((int)UserFieldIndex.BanZhi, value, true); }
		}
		/// <summary> The FullName property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."FullName"<br/>
		/// Table field type characteristics (type, precision, scale, length): NVarChar, 0, 0, 50<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): false, false, false</remarks>
		public virtual System.String FullName
		{
			get { return (System.String)GetValue((int)UserFieldIndex.FullName, true); }
			set	{ SetValue((int)UserFieldIndex.FullName, value, true); }
		}
		/// <summary> The Sex property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."Sex"<br/>
		/// Table field type characteristics (type, precision, scale, length): NVarChar, 0, 0, 50<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): false, false, false</remarks>
		public virtual System.String Sex
		{
			get { return (System.String)GetValue((int)UserFieldIndex.Sex, true); }
			set	{ SetValue((int)UserFieldIndex.Sex, value, true); }
		}
		/// <summary> The LoginName property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."LoginName"<br/>
		/// Table field type characteristics (type, precision, scale, length): NVarChar, 0, 0, 50<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): false, false, false</remarks>
		public virtual System.String LoginName
		{
			get { return (System.String)GetValue((int)UserFieldIndex.LoginName, true); }
			set	{ SetValue((int)UserFieldIndex.LoginName, value, true); }
		}
		/// <summary> The Password property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."Password"<br/>
		/// Table field type characteristics (type, precision, scale, length): NVarChar, 0, 0, 50<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): false, false, false</remarks>
		public virtual System.String Password
		{
			get { return (System.String)GetValue((int)UserFieldIndex.Password, true); }
			set	{ SetValue((int)UserFieldIndex.Password, value, true); }
		}
		/// <summary> The Address property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."Address"<br/>
		/// Table field type characteristics (type, precision, scale, length): NVarChar, 0, 0, 50<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String Address
		{
			get { return (System.String)GetValue((int)UserFieldIndex.Address, true); }
			set	{ SetValue((int)UserFieldIndex.Address, value, true); }
		}
		/// <summary> The Tel property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."Tel"<br/>
		/// Table field type characteristics (type, precision, scale, length): NVarChar, 0, 0, 50<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String Tel
		{
			get { return (System.String)GetValue((int)UserFieldIndex.Tel, true); }
			set	{ SetValue((int)UserFieldIndex.Tel, value, true); }
		}
		/// <summary> The Mobile property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."Mobile"<br/>
		/// Table field type characteristics (type, precision, scale, length): NVarChar, 0, 0, 50<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String Mobile
		{
			get { return (System.String)GetValue((int)UserFieldIndex.Mobile, true); }
			set	{ SetValue((int)UserFieldIndex.Mobile, value, true); }
		}
		/// <summary> The Email property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."Email"<br/>
		/// Table field type characteristics (type, precision, scale, length): NVarChar, 0, 0, 50<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String Email
		{
			get { return (System.String)GetValue((int)UserFieldIndex.Email, true); }
			set	{ SetValue((int)UserFieldIndex.Email, value, true); }
		}
		/// <summary> The CreateDate property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."CreateDate"<br/>
		/// Table field type characteristics (type, precision, scale, length): DateTime, 0, 0, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): false, false, false</remarks>
		public virtual System.DateTime CreateDate
		{
			get { return (System.DateTime)GetValue((int)UserFieldIndex.CreateDate, true); }
			set	{ SetValue((int)UserFieldIndex.CreateDate, value, true); }
		}
		/// <summary> The IsActived property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."IsActived"<br/>
		/// Table field type characteristics (type, precision, scale, length): Bit, 0, 0, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): false, false, false</remarks>
		public virtual System.Boolean IsActived
		{
			get { return (System.Boolean)GetValue((int)UserFieldIndex.IsActived, true); }
			set	{ SetValue((int)UserFieldIndex.IsActived, value, true); }
		}
		/// <summary> The BloodType property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."BloodType"<br/>
		/// Table field type characteristics (type, precision, scale, length): NVarChar, 0, 0, 50<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String BloodType
		{
			get { return (System.String)GetValue((int)UserFieldIndex.BloodType, true); }
			set	{ SetValue((int)UserFieldIndex.BloodType, value, true); }
		}
		/// <summary> The Marriage property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."Marriage"<br/>
		/// Table field type characteristics (type, precision, scale, length): NVarChar, 0, 0, 50<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String Marriage
		{
			get { return (System.String)GetValue((int)UserFieldIndex.Marriage, true); }
			set	{ SetValue((int)UserFieldIndex.Marriage, value, true); }
		}
		/// <summary> The Idcard property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."IDCard"<br/>
		/// Table field type characteristics (type, precision, scale, length): NVarChar, 0, 0, 50<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String Idcard
		{
			get { return (System.String)GetValue((int)UserFieldIndex.Idcard, true); }
			set	{ SetValue((int)UserFieldIndex.Idcard, value, true); }
		}
		/// <summary> The BirthDay property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."BirthDay"<br/>
		/// Table field type characteristics (type, precision, scale, length): DateTime, 0, 0, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual Nullable<System.DateTime> BirthDay
		{
			get { return (Nullable<System.DateTime>)GetValue((int)UserFieldIndex.BirthDay, false); }
			set	{ SetValue((int)UserFieldIndex.BirthDay, value, true); }
		}
		/// <summary> The Degree property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."Degree"<br/>
		/// Table field type characteristics (type, precision, scale, length): NVarChar, 0, 0, 50<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String Degree
		{
			get { return (System.String)GetValue((int)UserFieldIndex.Degree, true); }
			set	{ SetValue((int)UserFieldIndex.Degree, value, true); }
		}
		/// <summary> The Address1 property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."Address1"<br/>
		/// Table field type characteristics (type, precision, scale, length): NVarChar, 0, 0, 200<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String Address1
		{
			get { return (System.String)GetValue((int)UserFieldIndex.Address1, true); }
			set	{ SetValue((int)UserFieldIndex.Address1, value, true); }
		}
		/// <summary> The Address2 property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."Address2"<br/>
		/// Table field type characteristics (type, precision, scale, length): NVarChar, 0, 0, 200<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String Address2
		{
			get { return (System.String)GetValue((int)UserFieldIndex.Address2, true); }
			set	{ SetValue((int)UserFieldIndex.Address2, value, true); }
		}
		/// <summary> The UrgentPerson property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."UrgentPerson"<br/>
		/// Table field type characteristics (type, precision, scale, length): NVarChar, 0, 0, 50<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String UrgentPerson
		{
			get { return (System.String)GetValue((int)UserFieldIndex.UrgentPerson, true); }
			set	{ SetValue((int)UserFieldIndex.UrgentPerson, value, true); }
		}
		/// <summary> The UrgentTel property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."UrgentTel"<br/>
		/// Table field type characteristics (type, precision, scale, length): NVarChar, 0, 0, 50<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String UrgentTel
		{
			get { return (System.String)GetValue((int)UserFieldIndex.UrgentTel, true); }
			set	{ SetValue((int)UserFieldIndex.UrgentTel, value, true); }
		}
		/// <summary> The Bank property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."Bank"<br/>
		/// Table field type characteristics (type, precision, scale, length): Int, 10, 0, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual Nullable<System.Int32> Bank
		{
			get { return (Nullable<System.Int32>)GetValue((int)UserFieldIndex.Bank, false); }
			set	{ SetValue((int)UserFieldIndex.Bank, value, true); }
		}
		/// <summary> The BankIdCard property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."BankIdCard"<br/>
		/// Table field type characteristics (type, precision, scale, length): NVarChar, 0, 0, 50<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String BankIdCard
		{
			get { return (System.String)GetValue((int)UserFieldIndex.BankIdCard, true); }
			set	{ SetValue((int)UserFieldIndex.BankIdCard, value, true); }
		}
		/// <summary> The FamillyNumber property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."FamillyNumber"<br/>
		/// Table field type characteristics (type, precision, scale, length): Int, 10, 0, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual Nullable<System.Int32> FamillyNumber
		{
			get { return (Nullable<System.Int32>)GetValue((int)UserFieldIndex.FamillyNumber, false); }
			set	{ SetValue((int)UserFieldIndex.FamillyNumber, value, true); }
		}
		/// <summary> The SalaryLevel property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."SalaryLevel"<br/>
		/// Table field type characteristics (type, precision, scale, length): Int, 10, 0, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual Nullable<System.Int32> SalaryLevel
		{
			get { return (Nullable<System.Int32>)GetValue((int)UserFieldIndex.SalaryLevel, false); }
			set	{ SetValue((int)UserFieldIndex.SalaryLevel, value, true); }
		}
		/// <summary> The ZhiWuAllowance property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."ZhiWuAllowance"<br/>
		/// Table field type characteristics (type, precision, scale, length): Decimal, 18, 2, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): false, false, false</remarks>
		public virtual System.Decimal ZhiWuAllowance
		{
			get { return (System.Decimal)GetValue((int)UserFieldIndex.ZhiWuAllowance, true); }
			set	{ SetValue((int)UserFieldIndex.ZhiWuAllowance, value, true); }
		}
		/// <summary> The JianBaoAllowance property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."JianBaoAllowance"<br/>
		/// Table field type characteristics (type, precision, scale, length): Decimal, 18, 2, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): false, false, false</remarks>
		public virtual System.Decimal JianBaoAllowance
		{
			get { return (System.Decimal)GetValue((int)UserFieldIndex.JianBaoAllowance, true); }
			set	{ SetValue((int)UserFieldIndex.JianBaoAllowance, value, true); }
		}
		/// <summary> The LaoBaoAllowance property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."LaoBaoAllowance"<br/>
		/// Table field type characteristics (type, precision, scale, length): Decimal, 18, 2, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): false, false, false</remarks>
		public virtual System.Decimal LaoBaoAllowance
		{
			get { return (System.Decimal)GetValue((int)UserFieldIndex.LaoBaoAllowance, true); }
			set	{ SetValue((int)UserFieldIndex.LaoBaoAllowance, value, true); }
		}
		/// <summary> The HuoShiAllowance property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."HuoShiAllowance"<br/>
		/// Table field type characteristics (type, precision, scale, length): Decimal, 18, 2, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): false, false, false</remarks>
		public virtual System.Decimal HuoShiAllowance
		{
			get { return (System.Decimal)GetValue((int)UserFieldIndex.HuoShiAllowance, true); }
			set	{ SetValue((int)UserFieldIndex.HuoShiAllowance, value, true); }
		}
		/// <summary> The JiShuAllowance property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."JiShuAllowance"<br/>
		/// Table field type characteristics (type, precision, scale, length): Decimal, 18, 2, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): false, false, false</remarks>
		public virtual System.Decimal JiShuAllowance
		{
			get { return (System.Decimal)GetValue((int)UserFieldIndex.JiShuAllowance, true); }
			set	{ SetValue((int)UserFieldIndex.JiShuAllowance, value, true); }
		}
		/// <summary> The QiTaAllowance property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."QiTaAllowance"<br/>
		/// Table field type characteristics (type, precision, scale, length): Decimal, 18, 2, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): false, false, false</remarks>
		public virtual System.Decimal QiTaAllowance
		{
			get { return (System.Decimal)GetValue((int)UserFieldIndex.QiTaAllowance, true); }
			set	{ SetValue((int)UserFieldIndex.QiTaAllowance, value, true); }
		}
		/// <summary> The JiaoTongAllowance property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."JiaoTongAllowance"<br/>
		/// Table field type characteristics (type, precision, scale, length): Decimal, 18, 2, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): false, false, false</remarks>
		public virtual System.Decimal JiaoTongAllowance
		{
			get { return (System.Decimal)GetValue((int)UserFieldIndex.JiaoTongAllowance, true); }
			set	{ SetValue((int)UserFieldIndex.JiaoTongAllowance, value, true); }
		}
		/// <summary> The TongXunAllowance property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."TongXunAllowance"<br/>
		/// Table field type characteristics (type, precision, scale, length): Decimal, 18, 2, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): false, false, false</remarks>
		public virtual System.Decimal TongXunAllowance
		{
			get { return (System.Decimal)GetValue((int)UserFieldIndex.TongXunAllowance, true); }
			set	{ SetValue((int)UserFieldIndex.TongXunAllowance, value, true); }
		}
		/// <summary> The QuanQinAllowance property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."QuanQinAllowance"<br/>
		/// Table field type characteristics (type, precision, scale, length): Decimal, 18, 2, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): false, false, false</remarks>
		public virtual System.Decimal QuanQinAllowance
		{
			get { return (System.Decimal)GetValue((int)UserFieldIndex.QuanQinAllowance, true); }
			set	{ SetValue((int)UserFieldIndex.QuanQinAllowance, value, true); }
		}
		/// <summary> The LaoBaoSelfResponse property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."LaoBaoSelfResponse"<br/>
		/// Table field type characteristics (type, precision, scale, length): Decimal, 18, 2, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): false, false, false</remarks>
		public virtual System.Decimal LaoBaoSelfResponse
		{
			get { return (System.Decimal)GetValue((int)UserFieldIndex.LaoBaoSelfResponse, true); }
			set	{ SetValue((int)UserFieldIndex.LaoBaoSelfResponse, value, true); }
		}
		/// <summary> The JianBaoSelfResponse property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."JianBaoSelfResponse"<br/>
		/// Table field type characteristics (type, precision, scale, length): Decimal, 18, 2, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): false, false, false</remarks>
		public virtual System.Decimal JianBaoSelfResponse
		{
			get { return (System.Decimal)GetValue((int)UserFieldIndex.JianBaoSelfResponse, true); }
			set	{ SetValue((int)UserFieldIndex.JianBaoSelfResponse, value, true); }
		}
		/// <summary> The HuoShiSelfResponse property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."HuoShiSelfResponse"<br/>
		/// Table field type characteristics (type, precision, scale, length): Decimal, 18, 2, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): false, false, false</remarks>
		public virtual System.Decimal HuoShiSelfResponse
		{
			get { return (System.Decimal)GetValue((int)UserFieldIndex.HuoShiSelfResponse, true); }
			set	{ SetValue((int)UserFieldIndex.HuoShiSelfResponse, value, true); }
		}
		/// <summary> The FamilySelfResponse property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."FamilySelfResponse"<br/>
		/// Table field type characteristics (type, precision, scale, length): Decimal, 18, 2, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): false, false, false</remarks>
		public virtual System.Decimal FamilySelfResponse
		{
			get { return (System.Decimal)GetValue((int)UserFieldIndex.FamilySelfResponse, true); }
			set	{ SetValue((int)UserFieldIndex.FamilySelfResponse, value, true); }
		}
		/// <summary> The TouBaoDate property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."TouBaoDate"<br/>
		/// Table field type characteristics (type, precision, scale, length): DateTime, 0, 0, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual Nullable<System.DateTime> TouBaoDate
		{
			get { return (Nullable<System.DateTime>)GetValue((int)UserFieldIndex.TouBaoDate, false); }
			set	{ SetValue((int)UserFieldIndex.TouBaoDate, value, true); }
		}
		/// <summary> The TuiBaoDate property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."TuiBaoDate"<br/>
		/// Table field type characteristics (type, precision, scale, length): DateTime, 0, 0, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual Nullable<System.DateTime> TuiBaoDate
		{
			get { return (Nullable<System.DateTime>)GetValue((int)UserFieldIndex.TuiBaoDate, false); }
			set	{ SetValue((int)UserFieldIndex.TuiBaoDate, value, true); }
		}
		/// <summary> The DaoZhiDate property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."DaoZhiDate"<br/>
		/// Table field type characteristics (type, precision, scale, length): DateTime, 0, 0, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual Nullable<System.DateTime> DaoZhiDate
		{
			get { return (Nullable<System.DateTime>)GetValue((int)UserFieldIndex.DaoZhiDate, false); }
			set	{ SetValue((int)UserFieldIndex.DaoZhiDate, value, true); }
		}
		/// <summary> The LiZhiDate property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."LiZhiDate"<br/>
		/// Table field type characteristics (type, precision, scale, length): DateTime, 0, 0, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual Nullable<System.DateTime> LiZhiDate
		{
			get { return (Nullable<System.DateTime>)GetValue((int)UserFieldIndex.LiZhiDate, false); }
			set	{ SetValue((int)UserFieldIndex.LiZhiDate, value, true); }
		}
		/// <summary> The JiFen property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."JiFen"<br/>
		/// Table field type characteristics (type, precision, scale, length): Int, 10, 0, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual Nullable<System.Int32> JiFen
		{
			get { return (Nullable<System.Int32>)GetValue((int)UserFieldIndex.JiFen, false); }
			set	{ SetValue((int)UserFieldIndex.JiFen, value, true); }
		}
		/// <summary> The Status property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."Status"<br/>
		/// Table field type characteristics (type, precision, scale, length): Int, 10, 0, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): false, false, false</remarks>
		public virtual System.Int32 Status
		{
			get { return (System.Int32)GetValue((int)UserFieldIndex.Status, true); }
			set	{ SetValue((int)UserFieldIndex.Status, value, true); }
		}
		/// <summary> The Regex property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."Regex"<br/>
		/// Table field type characteristics (type, precision, scale, length): NVarChar, 0, 0, 50<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String Regex
		{
			get { return (System.String)GetValue((int)UserFieldIndex.Regex, true); }
			set	{ SetValue((int)UserFieldIndex.Regex, value, true); }
		}
		/// <summary> The Remark property of the Entity User<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "User"."Remark"<br/>
		/// Table field type characteristics (type, precision, scale, length): NText, 0, 0, 1073741823<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String Remark
		{
			get { return (System.String)GetValue((int)UserFieldIndex.Remark, true); }
			set	{ SetValue((int)UserFieldIndex.Remark, value, true); }
		}

		/// <summary> Retrieves all related entities of type 'MessageEntity' using a relation of type '1:n'.</summary>
		/// <remarks>This property is added for databinding conveniance, however it is recommeded to use the method 'GetMultiMessage()', because 
		/// this property is rather expensive and a method tells the user to cache the result when it has to be used more than once in the same scope.</remarks>
		public virtual CARMSData.CollectionClasses.MessageCollection Message
		{
			get	{ return GetMultiMessage(false); }
		}

		/// <summary> Gets / sets the lazy loading flag for Message. When set to true, Message is always refetched from the 
		/// persistent storage. When set to false, the data is only fetched the first time Message is accessed. You can always execute
		/// a forced fetch by calling GetMultiMessage(true).</summary>
		[Browsable(false)]
		public bool AlwaysFetchMessage
		{
			get	{ return _alwaysFetchMessage; }
			set	{ _alwaysFetchMessage = value; }	
		}		
				
		/// <summary>Gets / Sets the lazy loading flag if the property Message already has been fetched. Setting this property to false when Message has been fetched
		/// will clear the Message collection well. Setting this property to true while Message hasn't been fetched disables lazy loading for Message</summary>
		[Browsable(false)]
		public bool AlreadyFetchedMessage
		{
			get { return _alreadyFetchedMessage;}
			set 
			{
				if(_alreadyFetchedMessage && !value && (_message != null))
				{
					_message.Clear();
				}
				_alreadyFetchedMessage = value;
			}
		}
		/// <summary> Retrieves all related entities of type 'ReportHeaderEntity' using a relation of type '1:n'.</summary>
		/// <remarks>This property is added for databinding conveniance, however it is recommeded to use the method 'GetMultiReportHeader()', because 
		/// this property is rather expensive and a method tells the user to cache the result when it has to be used more than once in the same scope.</remarks>
		public virtual CARMSData.CollectionClasses.ReportHeaderCollection ReportHeader
		{
			get	{ return GetMultiReportHeader(false); }
		}

		/// <summary> Gets / sets the lazy loading flag for ReportHeader. When set to true, ReportHeader is always refetched from the 
		/// persistent storage. When set to false, the data is only fetched the first time ReportHeader is accessed. You can always execute
		/// a forced fetch by calling GetMultiReportHeader(true).</summary>
		[Browsable(false)]
		public bool AlwaysFetchReportHeader
		{
			get	{ return _alwaysFetchReportHeader; }
			set	{ _alwaysFetchReportHeader = value; }	
		}		
				
		/// <summary>Gets / Sets the lazy loading flag if the property ReportHeader already has been fetched. Setting this property to false when ReportHeader has been fetched
		/// will clear the ReportHeader collection well. Setting this property to true while ReportHeader hasn't been fetched disables lazy loading for ReportHeader</summary>
		[Browsable(false)]
		public bool AlreadyFetchedReportHeader
		{
			get { return _alreadyFetchedReportHeader;}
			set 
			{
				if(_alreadyFetchedReportHeader && !value && (_reportHeader != null))
				{
					_reportHeader.Clear();
				}
				_alreadyFetchedReportHeader = value;
			}
		}
		/// <summary> Retrieves all related entities of type 'UserActionEntity' using a relation of type '1:n'.</summary>
		/// <remarks>This property is added for databinding conveniance, however it is recommeded to use the method 'GetMultiUserAction()', because 
		/// this property is rather expensive and a method tells the user to cache the result when it has to be used more than once in the same scope.</remarks>
		public virtual CARMSData.CollectionClasses.UserActionCollection UserAction
		{
			get	{ return GetMultiUserAction(false); }
		}

		/// <summary> Gets / sets the lazy loading flag for UserAction. When set to true, UserAction is always refetched from the 
		/// persistent storage. When set to false, the data is only fetched the first time UserAction is accessed. You can always execute
		/// a forced fetch by calling GetMultiUserAction(true).</summary>
		[Browsable(false)]
		public bool AlwaysFetchUserAction
		{
			get	{ return _alwaysFetchUserAction; }
			set	{ _alwaysFetchUserAction = value; }	
		}		
				
		/// <summary>Gets / Sets the lazy loading flag if the property UserAction already has been fetched. Setting this property to false when UserAction has been fetched
		/// will clear the UserAction collection well. Setting this property to true while UserAction hasn't been fetched disables lazy loading for UserAction</summary>
		[Browsable(false)]
		public bool AlreadyFetchedUserAction
		{
			get { return _alreadyFetchedUserAction;}
			set 
			{
				if(_alreadyFetchedUserAction && !value && (_userAction != null))
				{
					_userAction.Clear();
				}
				_alreadyFetchedUserAction = value;
			}
		}
		/// <summary> Retrieves all related entities of type 'UserPermissionEntity' using a relation of type '1:n'.</summary>
		/// <remarks>This property is added for databinding conveniance, however it is recommeded to use the method 'GetMultiUserPermission()', because 
		/// this property is rather expensive and a method tells the user to cache the result when it has to be used more than once in the same scope.</remarks>
		public virtual CARMSData.CollectionClasses.UserPermissionCollection UserPermission
		{
			get	{ return GetMultiUserPermission(false); }
		}

		/// <summary> Gets / sets the lazy loading flag for UserPermission. When set to true, UserPermission is always refetched from the 
		/// persistent storage. When set to false, the data is only fetched the first time UserPermission is accessed. You can always execute
		/// a forced fetch by calling GetMultiUserPermission(true).</summary>
		[Browsable(false)]
		public bool AlwaysFetchUserPermission
		{
			get	{ return _alwaysFetchUserPermission; }
			set	{ _alwaysFetchUserPermission = value; }	
		}		
				
		/// <summary>Gets / Sets the lazy loading flag if the property UserPermission already has been fetched. Setting this property to false when UserPermission has been fetched
		/// will clear the UserPermission collection well. Setting this property to true while UserPermission hasn't been fetched disables lazy loading for UserPermission</summary>
		[Browsable(false)]
		public bool AlreadyFetchedUserPermission
		{
			get { return _alreadyFetchedUserPermission;}
			set 
			{
				if(_alreadyFetchedUserPermission && !value && (_userPermission != null))
				{
					_userPermission.Clear();
				}
				_alreadyFetchedUserPermission = value;
			}
		}
		/// <summary> Retrieves all related entities of type 'UserRoleEntity' using a relation of type '1:n'.</summary>
		/// <remarks>This property is added for databinding conveniance, however it is recommeded to use the method 'GetMultiUserRole()', because 
		/// this property is rather expensive and a method tells the user to cache the result when it has to be used more than once in the same scope.</remarks>
		public virtual CARMSData.CollectionClasses.UserRoleCollection UserRole
		{
			get	{ return GetMultiUserRole(false); }
		}

		/// <summary> Gets / sets the lazy loading flag for UserRole. When set to true, UserRole is always refetched from the 
		/// persistent storage. When set to false, the data is only fetched the first time UserRole is accessed. You can always execute
		/// a forced fetch by calling GetMultiUserRole(true).</summary>
		[Browsable(false)]
		public bool AlwaysFetchUserRole
		{
			get	{ return _alwaysFetchUserRole; }
			set	{ _alwaysFetchUserRole = value; }	
		}		
				
		/// <summary>Gets / Sets the lazy loading flag if the property UserRole already has been fetched. Setting this property to false when UserRole has been fetched
		/// will clear the UserRole collection well. Setting this property to true while UserRole hasn't been fetched disables lazy loading for UserRole</summary>
		[Browsable(false)]
		public bool AlreadyFetchedUserRole
		{
			get { return _alreadyFetchedUserRole;}
			set 
			{
				if(_alreadyFetchedUserRole && !value && (_userRole != null))
				{
					_userRole.Clear();
				}
				_alreadyFetchedUserRole = value;
			}
		}

		/// <summary> Retrieves all related entities of type 'ActionEntity' using a relation of type 'm:n'.</summary>
		/// <remarks>This property is added for databinding conveniance, however it is recommeded to use the method 'GetMultiActionCollectionViaUserAction()', because 
		/// this property is rather expensive and a method tells the user to cache the result when it has to be used more than once in the same scope.</remarks>
		public virtual CARMSData.CollectionClasses.ActionCollection ActionCollectionViaUserAction
		{
			get { return GetMultiActionCollectionViaUserAction(false); }
		}

		/// <summary> Gets / sets the lazy loading flag for ActionCollectionViaUserAction. When set to true, ActionCollectionViaUserAction is always refetched from the 
		/// persistent storage. When set to false, the data is only fetched the first time ActionCollectionViaUserAction is accessed. You can always execute
		/// a forced fetch by calling GetMultiActionCollectionViaUserAction(true).</summary>
		[Browsable(false)]
		public bool AlwaysFetchActionCollectionViaUserAction
		{
			get	{ return _alwaysFetchActionCollectionViaUserAction; }
			set	{ _alwaysFetchActionCollectionViaUserAction = value; }
		}
				
		/// <summary>Gets / Sets the lazy loading flag if the property ActionCollectionViaUserAction already has been fetched. Setting this property to false when ActionCollectionViaUserAction has been fetched
		/// will clear the ActionCollectionViaUserAction collection well. Setting this property to true while ActionCollectionViaUserAction hasn't been fetched disables lazy loading for ActionCollectionViaUserAction</summary>
		[Browsable(false)]
		public bool AlreadyFetchedActionCollectionViaUserAction
		{
			get { return _alreadyFetchedActionCollectionViaUserAction;}
			set 
			{
				if(_alreadyFetchedActionCollectionViaUserAction && !value && (_actionCollectionViaUserAction != null))
				{
					_actionCollectionViaUserAction.Clear();
				}
				_alreadyFetchedActionCollectionViaUserAction = value;
			}
		}
		/// <summary> Retrieves all related entities of type 'ReportCategoryEntity' using a relation of type 'm:n'.</summary>
		/// <remarks>This property is added for databinding conveniance, however it is recommeded to use the method 'GetMultiReportCategoryCollectionViaReportHeader()', because 
		/// this property is rather expensive and a method tells the user to cache the result when it has to be used more than once in the same scope.</remarks>
		public virtual CARMSData.CollectionClasses.ReportCategoryCollection ReportCategoryCollectionViaReportHeader
		{
			get { return GetMultiReportCategoryCollectionViaReportHeader(false); }
		}

		/// <summary> Gets / sets the lazy loading flag for ReportCategoryCollectionViaReportHeader. When set to true, ReportCategoryCollectionViaReportHeader is always refetched from the 
		/// persistent storage. When set to false, the data is only fetched the first time ReportCategoryCollectionViaReportHeader is accessed. You can always execute
		/// a forced fetch by calling GetMultiReportCategoryCollectionViaReportHeader(true).</summary>
		[Browsable(false)]
		public bool AlwaysFetchReportCategoryCollectionViaReportHeader
		{
			get	{ return _alwaysFetchReportCategoryCollectionViaReportHeader; }
			set	{ _alwaysFetchReportCategoryCollectionViaReportHeader = value; }
		}
				
		/// <summary>Gets / Sets the lazy loading flag if the property ReportCategoryCollectionViaReportHeader already has been fetched. Setting this property to false when ReportCategoryCollectionViaReportHeader has been fetched
		/// will clear the ReportCategoryCollectionViaReportHeader collection well. Setting this property to true while ReportCategoryCollectionViaReportHeader hasn't been fetched disables lazy loading for ReportCategoryCollectionViaReportHeader</summary>
		[Browsable(false)]
		public bool AlreadyFetchedReportCategoryCollectionViaReportHeader
		{
			get { return _alreadyFetchedReportCategoryCollectionViaReportHeader;}
			set 
			{
				if(_alreadyFetchedReportCategoryCollectionViaReportHeader && !value && (_reportCategoryCollectionViaReportHeader != null))
				{
					_reportCategoryCollectionViaReportHeader.Clear();
				}
				_alreadyFetchedReportCategoryCollectionViaReportHeader = value;
			}
		}
		/// <summary> Retrieves all related entities of type 'ReportCategoryEntity' using a relation of type 'm:n'.</summary>
		/// <remarks>This property is added for databinding conveniance, however it is recommeded to use the method 'GetMultiReportCategoryCollectionViaUserPermission()', because 
		/// this property is rather expensive and a method tells the user to cache the result when it has to be used more than once in the same scope.</remarks>
		public virtual CARMSData.CollectionClasses.ReportCategoryCollection ReportCategoryCollectionViaUserPermission
		{
			get { return GetMultiReportCategoryCollectionViaUserPermission(false); }
		}

		/// <summary> Gets / sets the lazy loading flag for ReportCategoryCollectionViaUserPermission. When set to true, ReportCategoryCollectionViaUserPermission is always refetched from the 
		/// persistent storage. When set to false, the data is only fetched the first time ReportCategoryCollectionViaUserPermission is accessed. You can always execute
		/// a forced fetch by calling GetMultiReportCategoryCollectionViaUserPermission(true).</summary>
		[Browsable(false)]
		public bool AlwaysFetchReportCategoryCollectionViaUserPermission
		{
			get	{ return _alwaysFetchReportCategoryCollectionViaUserPermission; }
			set	{ _alwaysFetchReportCategoryCollectionViaUserPermission = value; }
		}
				
		/// <summary>Gets / Sets the lazy loading flag if the property ReportCategoryCollectionViaUserPermission already has been fetched. Setting this property to false when ReportCategoryCollectionViaUserPermission has been fetched
		/// will clear the ReportCategoryCollectionViaUserPermission collection well. Setting this property to true while ReportCategoryCollectionViaUserPermission hasn't been fetched disables lazy loading for ReportCategoryCollectionViaUserPermission</summary>
		[Browsable(false)]
		public bool AlreadyFetchedReportCategoryCollectionViaUserPermission
		{
			get { return _alreadyFetchedReportCategoryCollectionViaUserPermission;}
			set 
			{
				if(_alreadyFetchedReportCategoryCollectionViaUserPermission && !value && (_reportCategoryCollectionViaUserPermission != null))
				{
					_reportCategoryCollectionViaUserPermission.Clear();
				}
				_alreadyFetchedReportCategoryCollectionViaUserPermission = value;
			}
		}
		/// <summary> Retrieves all related entities of type 'ReportFlowEntity' using a relation of type 'm:n'.</summary>
		/// <remarks>This property is added for databinding conveniance, however it is recommeded to use the method 'GetMultiReportFlowCollectionViaReportHeader()', because 
		/// this property is rather expensive and a method tells the user to cache the result when it has to be used more than once in the same scope.</remarks>
		public virtual CARMSData.CollectionClasses.ReportFlowCollection ReportFlowCollectionViaReportHeader
		{
			get { return GetMultiReportFlowCollectionViaReportHeader(false); }
		}

		/// <summary> Gets / sets the lazy loading flag for ReportFlowCollectionViaReportHeader. When set to true, ReportFlowCollectionViaReportHeader is always refetched from the 
		/// persistent storage. When set to false, the data is only fetched the first time ReportFlowCollectionViaReportHeader is accessed. You can always execute
		/// a forced fetch by calling GetMultiReportFlowCollectionViaReportHeader(true).</summary>
		[Browsable(false)]
		public bool AlwaysFetchReportFlowCollectionViaReportHeader
		{
			get	{ return _alwaysFetchReportFlowCollectionViaReportHeader; }
			set	{ _alwaysFetchReportFlowCollectionViaReportHeader = value; }
		}
				
		/// <summary>Gets / Sets the lazy loading flag if the property ReportFlowCollectionViaReportHeader already has been fetched. Setting this property to false when ReportFlowCollectionViaReportHeader has been fetched
		/// will clear the ReportFlowCollectionViaReportHeader collection well. Setting this property to true while ReportFlowCollectionViaReportHeader hasn't been fetched disables lazy loading for ReportFlowCollectionViaReportHeader</summary>
		[Browsable(false)]
		public bool AlreadyFetchedReportFlowCollectionViaReportHeader
		{
			get { return _alreadyFetchedReportFlowCollectionViaReportHeader;}
			set 
			{
				if(_alreadyFetchedReportFlowCollectionViaReportHeader && !value && (_reportFlowCollectionViaReportHeader != null))
				{
					_reportFlowCollectionViaReportHeader.Clear();
				}
				_alreadyFetchedReportFlowCollectionViaReportHeader = value;
			}
		}
		/// <summary> Retrieves all related entities of type 'ReportHeaderEntity' using a relation of type 'm:n'.</summary>
		/// <remarks>This property is added for databinding conveniance, however it is recommeded to use the method 'GetMultiReportHeaderCollectionViaMessage()', because 
		/// this property is rather expensive and a method tells the user to cache the result when it has to be used more than once in the same scope.</remarks>
		public virtual CARMSData.CollectionClasses.ReportHeaderCollection ReportHeaderCollectionViaMessage
		{
			get { return GetMultiReportHeaderCollectionViaMessage(false); }
		}

		/// <summary> Gets / sets the lazy loading flag for ReportHeaderCollectionViaMessage. When set to true, ReportHeaderCollectionViaMessage is always refetched from the 
		/// persistent storage. When set to false, the data is only fetched the first time ReportHeaderCollectionViaMessage is accessed. You can always execute
		/// a forced fetch by calling GetMultiReportHeaderCollectionViaMessage(true).</summary>
		[Browsable(false)]
		public bool AlwaysFetchReportHeaderCollectionViaMessage
		{
			get	{ return _alwaysFetchReportHeaderCollectionViaMessage; }
			set	{ _alwaysFetchReportHeaderCollectionViaMessage = value; }
		}
				
		/// <summary>Gets / Sets the lazy loading flag if the property ReportHeaderCollectionViaMessage already has been fetched. Setting this property to false when ReportHeaderCollectionViaMessage has been fetched
		/// will clear the ReportHeaderCollectionViaMessage collection well. Setting this property to true while ReportHeaderCollectionViaMessage hasn't been fetched disables lazy loading for ReportHeaderCollectionViaMessage</summary>
		[Browsable(false)]
		public bool AlreadyFetchedReportHeaderCollectionViaMessage
		{
			get { return _alreadyFetchedReportHeaderCollectionViaMessage;}
			set 
			{
				if(_alreadyFetchedReportHeaderCollectionViaMessage && !value && (_reportHeaderCollectionViaMessage != null))
				{
					_reportHeaderCollectionViaMessage.Clear();
				}
				_alreadyFetchedReportHeaderCollectionViaMessage = value;
			}
		}
		/// <summary> Retrieves all related entities of type 'RoleEntity' using a relation of type 'm:n'.</summary>
		/// <remarks>This property is added for databinding conveniance, however it is recommeded to use the method 'GetMultiRoleCollectionViaUserRole()', because 
		/// this property is rather expensive and a method tells the user to cache the result when it has to be used more than once in the same scope.</remarks>
		public virtual CARMSData.CollectionClasses.RoleCollection RoleCollectionViaUserRole
		{
			get { return GetMultiRoleCollectionViaUserRole(false); }
		}

		/// <summary> Gets / sets the lazy loading flag for RoleCollectionViaUserRole. When set to true, RoleCollectionViaUserRole is always refetched from the 
		/// persistent storage. When set to false, the data is only fetched the first time RoleCollectionViaUserRole is accessed. You can always execute
		/// a forced fetch by calling GetMultiRoleCollectionViaUserRole(true).</summary>
		[Browsable(false)]
		public bool AlwaysFetchRoleCollectionViaUserRole
		{
			get	{ return _alwaysFetchRoleCollectionViaUserRole; }
			set	{ _alwaysFetchRoleCollectionViaUserRole = value; }
		}
				
		/// <summary>Gets / Sets the lazy loading flag if the property RoleCollectionViaUserRole already has been fetched. Setting this property to false when RoleCollectionViaUserRole has been fetched
		/// will clear the RoleCollectionViaUserRole collection well. Setting this property to true while RoleCollectionViaUserRole hasn't been fetched disables lazy loading for RoleCollectionViaUserRole</summary>
		[Browsable(false)]
		public bool AlreadyFetchedRoleCollectionViaUserRole
		{
			get { return _alreadyFetchedRoleCollectionViaUserRole;}
			set 
			{
				if(_alreadyFetchedRoleCollectionViaUserRole && !value && (_roleCollectionViaUserRole != null))
				{
					_roleCollectionViaUserRole.Clear();
				}
				_alreadyFetchedRoleCollectionViaUserRole = value;
			}
		}
		/// <summary> Retrieves all related entities of type 'TemplateEntity' using a relation of type 'm:n'.</summary>
		/// <remarks>This property is added for databinding conveniance, however it is recommeded to use the method 'GetMultiTemplateCollectionViaMessage()', because 
		/// this property is rather expensive and a method tells the user to cache the result when it has to be used more than once in the same scope.</remarks>
		public virtual CARMSData.CollectionClasses.TemplateCollection TemplateCollectionViaMessage
		{
			get { return GetMultiTemplateCollectionViaMessage(false); }
		}

		/// <summary> Gets / sets the lazy loading flag for TemplateCollectionViaMessage. When set to true, TemplateCollectionViaMessage is always refetched from the 
		/// persistent storage. When set to false, the data is only fetched the first time TemplateCollectionViaMessage is accessed. You can always execute
		/// a forced fetch by calling GetMultiTemplateCollectionViaMessage(true).</summary>
		[Browsable(false)]
		public bool AlwaysFetchTemplateCollectionViaMessage
		{
			get	{ return _alwaysFetchTemplateCollectionViaMessage; }
			set	{ _alwaysFetchTemplateCollectionViaMessage = value; }
		}
				
		/// <summary>Gets / Sets the lazy loading flag if the property TemplateCollectionViaMessage already has been fetched. Setting this property to false when TemplateCollectionViaMessage has been fetched
		/// will clear the TemplateCollectionViaMessage collection well. Setting this property to true while TemplateCollectionViaMessage hasn't been fetched disables lazy loading for TemplateCollectionViaMessage</summary>
		[Browsable(false)]
		public bool AlreadyFetchedTemplateCollectionViaMessage
		{
			get { return _alreadyFetchedTemplateCollectionViaMessage;}
			set 
			{
				if(_alreadyFetchedTemplateCollectionViaMessage && !value && (_templateCollectionViaMessage != null))
				{
					_templateCollectionViaMessage.Clear();
				}
				_alreadyFetchedTemplateCollectionViaMessage = value;
			}
		}




		/// <summary> Gets or sets a value indicating whether this entity is a subtype</summary>
		protected override bool LLBLGenProIsSubType
		{
			get { return false;}
		}

		/// <summary> Gets the type of the hierarchy this entity is in. </summary>
		[System.ComponentModel.Browsable(false), XmlIgnore]
		protected override InheritanceHierarchyType LLBLGenProIsInHierarchyOfType
		{
			get { return InheritanceHierarchyType.None;}
		}
		
		/// <summary>Returns the CARMSData.EntityType enum value for this entity.</summary>
		[Browsable(false), XmlIgnore]
		public override int LLBLGenProEntityTypeValue 
		{ 
			get { return (int)CARMSData.EntityType.UserEntity; }
		}
		#endregion


		#region Custom Entity code
		
		// __LLBLGENPRO_USER_CODE_REGION_START CustomEntityCode
		// __LLBLGENPRO_USER_CODE_REGION_END
		#endregion

		#region Included code

		#endregion
	}
}
